Skip to content

Instantly share code, notes, and snippets.

@mritzco
Created April 2, 2022 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mritzco/17a9690d3583d17bb1a135afef50c22b to your computer and use it in GitHub Desktop.
Save mritzco/17a9690d3583d17bb1a135afef50c22b to your computer and use it in GitHub Desktop.
Undo the last local commit, fix and re-commit
git commit -m "Something terribly misguided" # (0: Your Accident)
git reset HEAD~ # (1)
#[ edit files as necessary ] # (2)
git add . # (3)
git commit -c ORIG_HEAD # (4)
#Ref: https://stackoverflow.com/questions/927358/how-do-i-undo-the-most-recent-local-commits-in-git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment