Created
March 14, 2014 17:04
-
-
Save simonwagner/9552064 to your computer and use it in GitHub Desktop.
Fixup alias for simply fixing a commit.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This will the fixup command to git | |
#git fixup $commit will use your current index to fixup the specified commit | |
#This is done by doing git commit --fixup $commit and then using rebase with autosquash | |
#Based upon http://stackoverflow.com/a/21148981/460564 | |
[alias] | |
fixup = "!sh -c '(git diff-files --quiet || (echo Unstaged changes, please commit or stash with --keep-index; exit 1)) && COMMIT=$(git rev-parse $1) && git commit --fixup=$COMMIT && git rebase -i --autosquash $COMMIT~1' -" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment