Created
December 9, 2019 06:42
-
-
Save alphamarket/a6349c5d2a4716d3d4bf165076ee27fa to your computer and use it in GitHub Desktop.
How to add a changed file to an older (not last) commit in Git
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
# To "fix" an old commit with a small change, without changing the commit message | |
# of the old commit, where OLDCOMMIT is something like 091b73a: | |
# Copied from `https://stackoverflow.com/a/27721031/1198291` | |
git add <my fixed files> | |
git commit --fixup=OLDCOMMIT | |
git rebase --interactive --autosquash OLDCOMMIT^ # at here do noting and exit from editor, it will do the job |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment