How to delete last commit in git
I always struggle to remember how to delete last commit in git - not that I’ve to do it often btw 😝
The git reset command permits to reset current HEAD to the
We can use the syntax
HEAD~1 to specify the desired state; it means one commit back from
Putting everything together:
git reset --soft HEAD~1
--soft flag assures the changes are preserved in the working copy.
If this is not what you want - better be sure this is the case - replace
git reset --hard HEAD~1
Looking forward deleting my next commit - or maybe not.