git reflog Recover lost commits from the local movement log
Shows a private log of where HEAD and your branches have pointed, including after resets, rebases and deleted branches. It is your safety net for "I lost my work".
Synopsis
git reflog [show] [REF]
git reflog expire [OPTION]...
Common options
| Option or form | What it does |
|---|---|
show | The default: list recent positions of HEAD |
REF | Show the reflog of a branch instead, such as main |
--date=relative | Show times like "2 hours ago" |
-n N | Limit the number of entries |
expire | Prune old entries (usually unnecessary) |
Examples
git reflog
3f2a9c1 HEAD@{0}: reset: moving to HEAD~2
8b1d7e4 HEAD@{1}: commit: Add contact form
git reset --hard HEAD@{1}
git branch rescued 8b1d7e4
git reflog --date=relative
Notes
- The reflog is local only. It is not pushed and does not exist on a fresh clone.
- Entries expire after about 90 days, and unreachable commits are eventually cleaned up.
- Find the hash in the log first, then create a branch from it so it cannot be lost again.
See also
Last reviewed 2026-10-09.