Undo last Git commit
14 June 2022 (Updated 1 September 2022)
TODO: Mental model of Git is a bit fuzzy. Need to read up more on it.
git reset --soft HEAD~1
This will remove the last commit message and rollback your working tree and index to what it was just before you committed. So all the changes in your last commit will remain intact but the commit message will be removed.
This is useful when you want to make a change to your previous commit.
Tagged:
Git
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment