git-reflog
Record and recover reference movements
TLDR
SYNOPSIS
git reflog [command] [options]
DESCRIPTION
git reflog records when refs (like HEAD and branch tips) are updated, providing a safety net for recovering lost commits. After accidental resets, rebases, or branch deletions, the reflog shows where refs previously pointed, allowing recovery of otherwise unreachable commits.Entries expire after a configurable period: reachable entries after 90 days (`gc.reflogExpire`), unreachable ones after 30 days (`gc.reflogExpireUnreachable`). The reflog is local only and is not shared between repositories.
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.
INSTALL
CAVEATS
Local only, not pushed. Entries expire (90 days reachable, 30 days unreachable, by default). Won't help after gc removes the underlying objects.
HISTORY
git reflog is a core Git safety feature, providing local history of ref movements to enable recovery from destructive operations.