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 formWhat it does
showThe default: list recent positions of HEAD
REFShow the reflog of a branch instead, such as main
--date=relativeShow times like "2 hours ago"
-n NLimit the number of entries
expirePrune old entries (usually unnecessary)

Examples

See where HEAD has been
git reflog
3f2a9c1 HEAD@{0}: reset: moving to HEAD~2
8b1d7e4 HEAD@{1}: commit: Add contact form
Get back to before a bad reset
git reset --hard HEAD@{1}
Recover a deleted branch
git branch rescued 8b1d7e4
Show times in plain words
git reflog --date=relative

Notes

See also

Last reviewed 2026-10-09.