Today I Learned

hashrocket A Hashrocket project

Undo Any Git Action ⎌

git reflog is a record of your commands in Git. With it, you can undo almost anything.

$ git reflog

4bd0090 HEAD@{0}: 
46bd839 HEAD@{1}: 
967e214 HEAD@{2}: 
46bd839 HEAD@{3}: 
967e214 HEAD@{4}: 

Reset your branch to its reference name:

$ git reset --hard HEAD@{2}

Or reset it to the SHA:

$ git reset --hard 967e214