How can I undo the last Git commit?

So you have made a mistake like eating last nights left of curry and now you are regretting it, unfortunately you can't take that one back but thankfully with Git you can get back to a state of sanity, ready? Here we go!

Undo Your Last Commit

$ git reset --soft HEAD~1

git reset will rewind the current HEAD branch to the specified revision.

Leave a comment

Your email address will not be published. Required fields are marked *