git-reflog
TLDR
Show reflog
$ git reflog
Show reflog for branch$ git reflog [branch]
Show with timestamps$ git reflog --date=relative
Expire old entries$ git reflog expire --expire=[90.days] --all
Delete specific entry$ git reflog delete HEAD@{2}
SYNOPSIS
git reflog [command] [options]
DESCRIPTION
git reflog records when refs are updated. It tracks branch tip movements, providing a safety net for recovering lost commits after resets, rebases, or accidental deletions.
The reflog shows where HEAD and branches pointed over time. Entries can be used to recover commits that are no longer reachable from any branch.
git reflog is essential for recovering from mistakes.
PARAMETERS
show REF
Show reflog for ref (default).expire
Prune old reflog entries.delete
Delete specific entries.--all
Process all refs.--expire TIME
Expire older than time.--date FORMAT
Date format.-n NUM
Limit entries shown.--help
Display help information.
CAVEATS
Local only, not pushed. Entries expire (default 90 days). Won't help after gc removes objects.
HISTORY
git reflog is a core Git safety feature, providing local history of ref movements to enable recovery from destructive operations.


