JAEN

Git

git reflog

SafeHEAD history (lifesaver)

git reflog

Every HEAD move is recorded — recover 'lost' commits after reset --hard or a bad rebase.

Examples

  • git reflogFind a lost commit
  • git reset --hard HEAD@{2}Restore an earlier state

Syntax

git reflog [show] [branch]

Before you run it

Viewing is safe; recover with care.

Used when you see

Stuck in detached HEAD
3
If you already moved away, recover via reflog
See the whole flow →
Broke history with reset/rebase
1
Find the pre-disaster commit in reflogHEAD@{n} addresses any prior state directly.
See the whole flow →

Related commands

The same reference, with no signal at all

Every command and flow from this site, held on your device and searchable with no connection. Free to install, no ads.

Get it free on the App Store