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 usinggit add). Unstaged changes are temporarily stashed.git amend COMMIT_REF- Amend the given commit (likegit commit --amend) with the currently staged changes (stage usinggit 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 hash3e58f12.
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 usinggit commit --amend. Resume withgit rebase --continue. Not compatible with--interactiveas 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24759faa7c9e519a35c3e759595bd523ffa01abff0d9cb23acebe31e845a7f91
|
|
| MD5 |
7b70bf0af804db5eb6f96f92602a5741
|
|
| BLAKE2b-256 |
328174878207389112e9d67febd9d976ac07a7cc817876fe54c7d8a9297556eb
|
File details
Details for the file git_fixup_commands-1.0.2-py3-none-any.whl.
File metadata
- Download URL: git_fixup_commands-1.0.2-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bee740a05c10a7b4906224da87338f348d6bee50f6aec043cb58c5b864faf55
|
|
| MD5 |
5812d6a216201ed2016b2a39c64d03b0
|
|
| BLAKE2b-256 |
9bf643b14d5073399060298cf7eb652d8c174336c85667b956ce0526ee7d003c
|