Skip to main content

Git Fixup Commands

pip install git-fixup-commands

A suite of Git commands to easily edit any previous commits via git commit --fixup and git rebase --autosquash. Works with any commit in the commit tree, including the root commit and merge commits.

Commands

  • git fixup COMMIT_REF - Fixup the given commit with the currently staged changes (stage using git add). Unstaged changes are temporarily stashed.
  • git amend COMMIT_REF - Amend the given commit (like git commit --amend) with the currently staged changes (stage using git add). Unstaged changes are temporarily stashed.
  • git reword COMMIT_REF - Reword / edit the commit message of the given commit.

Examples

  • git fixup HEAD~2 - Apply staged changes the commit before the previous commit.
  • git reword 3e58f12 - Edit the commit message of the commit with hash 3e58f12.

Options

All the commands above support the following options:

  • -p, --pause - Pause the rebase after the commit is updated. Allows for editing the newly modified commit using git commit --amend. Resume with git rebase --continue. Not compatible with --interactive as the sequence editor is overridden.

All flags from git rebase are supported. Note that --autosquash, --autostash, and --rebase-merges are already set. For example, the following may be useful:

  • -i, --interactive - Enable the interactive rebase editor, which allows interactive editing of commits between the modified commit and HEAD.

Installation

The suite of commands can be installed to your system path (via the Python script folder) using pip install git-fixup-commands.

Limitations

  • Merge commits are recreated, meaning changes may need to be made again if git does not have a recorded resolution to reuse.

How It Works

The provided commands are mainly a wrapper around two Git commands, git commit --fixup and git rebase --autosquash. The first command creates a special fixup commit which is then processed by the second command and squashed into the indicated commit.

Repository

Running

The project can be installed to your system using python3 -m pip install -e .. Commands can also be run using python3 main.py COMMAND.

Testing

A suite of scenario-based tests, which run the commands in real Git repositories, is provided in the test folder. These tests can be run with python3 test/test.py.

Metadata

Release files for git-fixup-commands 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for git-fixup-commands 1.0.2
File Size Uploaded
git_fixup_commands-1.0.2.tar.gz 9.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for git-fixup-commands 1.0.2
File Interpreter ABI Platform
git_fixup_commands-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 20.4 kB

Release files / git_fixup_commands-1.0.2.tar.gz

Download URL git_fixup_commands-1.0.2.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
24759faa7c9e519a35c3e759595bd523ffa01abff0d9cb23acebe31e845a7f91
BLAKE2b-256 checksum
How to use checksums
328174878207389112e9d67febd9d976ac07a7cc817876fe54c7d8a9297556eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.9

Release files / git_fixup_commands-1.0.2-py3-none-any.whl

Download URL git_fixup_commands-1.0.2-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4bee740a05c10a7b4906224da87338f348d6bee50f6aec043cb58c5b864faf55
BLAKE2b-256 checksum
How to use checksums
9bf643b14d5073399060298cf7eb652d8c174336c85667b956ce0526ee7d003c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page