-
Stash any unstaged changes
-
Rebase to desired commit
git rebase -i HEAD~2 # Optionally use `git commit -i <sha1>~` if you don't want to count
-
Change
pick
toedit
for the desire commmit
Hint: In vim pressi
to enter insert mode and pressesc + : + wq
to save and quit. -
Make the changes you want to amend to the commit and stage them with:
git add .
-
Amend the commit with:
git commit --amend
Hint: In vim press press
: + wq
to save and quit. -
Finish the rebase by running:
git rebase --continue
Last active
January 19, 2024 21:27
-
-
Save HaydenElza/0a36b14c00e8833907f2f8f4a365c7a9 to your computer and use it in GitHub Desktop.
Git amend second to last commit.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment