git reset --hard HEAD@{1}

Category: Git - Advanced

git reset --hard HEAD@{1}

Undo a bad reset using the reflog

Resets to the state recorded one step ago in the reflog, the standard escape hatch after a destructive reset --hard. The reflog logs every HEAD movement, so the lost commit is usually still reachable. Do this before garbage collection prunes the orphaned objects.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.