Docs Library
Recovering with reflog
Use reflog to locate previous references and recover from reset, rebase, or lost branch states.
What reflog is
Reflog is a local record of reference movement. When HEAD or a branch reference changes, Git usually records that movement.
That makes it especially useful after:
- a reset you regret
- a rebase that went wrong
- a checkout, merge, or commit you want to backtrack from
The usual recovery flow
git reflog
git branch recovery/<name> <commit>
Create a rescue branch first when you want a safer recovery path.