DEV Community

Discussion on: Life-saving git commands

Collapse
octaneinteractive profile image
Wayne Smallman

A personal favourite is:

git reset HEAD^

… to undo the last commit, or:

git reset HEAD~n

… where n is the number of commits to undo.

Collapse
octaneinteractive profile image
Wayne Smallman

It becomes a bit problematic if you've done a push beforehand!