Last active
December 17, 2015 16:09
-
-
Save raine/5636366 to your computer and use it in GitHub Desktop.
A git alias for fixing (or "amending") an earlier commit in the history.
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
; 1. Stage the changes you want to have amended to the earlier commit | |
; 2. `$ git fix <revision>` (e.g. `git fix HEAD~4`or `git fix bbfba98`) | |
[alias] | |
fix = "!_() { c=$(git rev-parse $1) && git commit --fixup $c && if grep -qv \"No local changes\" <<<$(git stash); then s=1; fi; git -c core.editor=cat rebase -i --autosquash $c~; if [[ -n "$s" ]]; then git stash pop; fi; }; _" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You should avoid use of
<<<
redirection which is not available on dash and dash is called by default by Git!
on many systems.Here's an alternative: