Last active
May 18, 2017 15:13
-
-
Save s7anley/115ca5ad6e01829c2f4196917320c082 to your computer and use it in GitHub Desktop.
Amend of history commit for forgotten file.
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
#!/usr/bin/env bash | |
$(git diff-index --quiet HEAD $1) > /dev/null | |
FILE_CHANGED=$? | |
if [ $FILE_CHANGED -eq 1 ];then | |
COMMIT=$(git log -n 1 --pretty=format:%H -- $1) | |
git add $1 | |
git commit --fixup=$COMMIT | |
git rebase --interactive --autosquash $COMMIT^ | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment