DEV Community

Discussion on: What is your favourite Git command?

Collapse
 
hozefaj profile image
Hozefa

For me git reset --soft HEAD 1, I have a git alias for this git undo. This is particularly useful for me when I want to fix small mistakes in committed files, without adding a new commit.

Also, git reflog. Very useful to get info about commits from deleted branches.

Collapse
 
kkm000 profile image
Cy "kkm" K'Nelson

HEAD~1, you missed the tilde. Also, --soft and 1 are the defaults, and @ can be used as a shorthand for HEAD when it's part of a relative graph distance expression, so it's simply

git reset @~

undo is still shorter : )