How to Recover Lost Commits With git reflog
git reflog records every position HEAD has pointed to, letting you recover commits that seem lost after a reset, rebase, or branch deletion.
Published September 28, 2026
git reflog records every position HEAD has pointed to, letting you recover commits that seem lost after a reset, rebase, or branch deletion.
Key points
- Even commits no longer reachable from any branch usually still appear in the reflog for a while
- Find the commit hash you need in the reflog output, then git checkout <hash> or git branch recovery <hash> to restore it
- The reflog is local only and expires after a period (90 days by default for reachable entries) — it isn't a permanent backup
Example
git reflog