Skip to main content

A suite of Git commands to easily edit any previous commits via `git commit --fixup` and `git rebase --autosquash`.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git_fixup_commands-1.0.2.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

git_fixup_commands-1.0.2-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file git_fixup_commands-1.0.2.tar.gz.

File metadata

  • Download URL: git_fixup_commands-1.0.2.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for git_fixup_commands-1.0.2.tar.gz
Algorithm Hash digest
SHA256 24759faa7c9e519a35c3e759595bd523ffa01abff0d9cb23acebe31e845a7f91
MD5 7b70bf0af804db5eb6f96f92602a5741
BLAKE2b-256 328174878207389112e9d67febd9d976ac07a7cc817876fe54c7d8a9297556eb

See more details on using hashes here.

File details

Details for the file git_fixup_commands-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for git_fixup_commands-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4bee740a05c10a7b4906224da87338f348d6bee50f6aec043cb58c5b864faf55
MD5 5812d6a216201ed2016b2a39c64d03b0
BLAKE2b-256 9bf643b14d5073399060298cf7eb652d8c174336c85667b956ce0526ee7d003c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page