Created
October 16, 2017 09:29
-
-
Save pcejrowski/8aed3cb839904f8df9e3f73c30cf50d2 to your computer and use it in GitHub Desktop.
Git ammending old commits
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
#!/bin/bash | |
# Usage: | |
# ./git_ammend_old.sh <commit-sha> | |
# then we change pick to edit for this commit in interactive mode | |
set -evx | |
git stash && \ | |
echo "REMEBER TO CHANGE THE COMMIT TO EDIT" && \ | |
git rebase --interactive "${1}^" && \ | |
git stash pop && \ | |
git commit --all --amend --no-edit && \ | |
git rebase --continue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment