git reflog

Ever used git reset --hard HEAD~1 to undo a commit, and then realize you made a horrible mistake (like running in the wrong repo just now, *ahem*)? Turns out git can still protect you!

git reflog show # look at your recent reference log, which includes things beyond commits

git reset HEAD@{1} # probably what you want, resets your HEAD to go back a reference

This and more is hidden in the magic of the .git/ directory in each and every one of your repositories.

results matching ""

    No results matching ""