-
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
picktoeditfor the desired commmit
Hint: In vim pressito enter insert mode and pressesc + : + wqto 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
: + wqto save and quit. -
Finish the rebase by running:
git rebase --continue
Last active
March 21, 2025 18:52
-
-
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