Git · History and recovery

git reflog

A local log of where HEAD has been. It is the fastest way to recover commits after a reset.

Syntax
git reflog

Example

Example
git reflog
git reset --hard HEAD@{2}

More in this group

git clean git reset --hard git reset --mixed git reset --soft git restore git revert git stash git stash apply vs pop

Learn this in the course

Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.

Open the course