DEV Community

Discussion on: Undo in Git: How to fix common mistakes

Collapse
 
bengineer52 profile image
bengineer

I usually use git reset --soft HEAD^ to undo my last commit.
You can add it as a shortcut to git:
git config --global alias.undo "reset --soft HEAD^"
Now you can reset you last commit by running: git undo