Created
March 10, 2020 04:42
-
-
Save micoli/8605b49af16cf89f34480882600391bb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| [alias] | |
| ... | |
| # fixup for a file, using the commit where it was last modified | |
| fixup-file = "!sh -c '\ | |
| [ $(git diff --numstat $1 | wc -l) -eq 1 ] && git add $1 && \ | |
| [ $(git diff --cached --numstat $1 | wc -l) -eq 1 ] || (echo No changes staged. ; exit 1) && \ | |
| COMMIT=$(git log -n 1 --pretty=format:"%H" $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