git add -p on steroids for patches.
my.patch you can run
You can choose in which bucket to put each hunk.
At any moment, you can quit and
my.patch will contain unassigned hunks while all the other hunks will be moved to
git-split-commit command uses
split-patch.py to split the
HEAD commit in multiple commits.
# Create backup tag git tag backup-$(date +'%s') # Split HEAD ./git-split-commit
By default, it first
git revert HEAD and then commit all the patches resulting from the split.
If you don't care about the original commit + revert commit pair, you can run:
Usage in interactive rebase
You can use
git-split-commit during interactive rebase, assuming you have it in
git rebase -i HEAD^^^^
$EDITOR will pop up with a series of
pick commands. After the commit you want to split add:
exec git split-commit