Skip to content

Instantly share code, notes, and snippets.

@simonwagner
Created March 14, 2014 17:04
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save simonwagner/9552064 to your computer and use it in GitHub Desktop.
Save simonwagner/9552064 to your computer and use it in GitHub Desktop.
Fixup alias for simply fixing a commit.
#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