Skip to content

Instantly share code, notes, and snippets.

@raditotev
Created April 23, 2021 15:51
Show Gist options
  • Save raditotev/82bd74ea5b94f4e7b712204db19f55c0 to your computer and use it in GitHub Desktop.
Save raditotev/82bd74ea5b94f4e7b712204db19f55c0 to your computer and use it in GitHub Desktop.
Amend previous commit
git rebase --interactive 'bbc643cd^' #include carret ^ at the end to rebase to the commit before the one to edit
# In the default editor, modify pick to edit in the line mentioning 'bbc643cd'.
# Rebase will stop at the requested commit, i.e. bbc643cd
# Make and stage changes
git commit --amend # or git commit --amend -m "an updated commit message" if you want to change message too
git rebase --continue # this will apply the rest of the commits and bring you to HEAD
# WARNING: Note that this will change the SHA-1 of that commit as well as all children
# https://stackoverflow.com/questions/1186535/how-to-modify-a-specified-commit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment