Command Reference
git reflog
Read reference movement history, which makes reflog one of the most important commands for recovery after reset, rebase, and branch mistakes.
git reflog records where refs such as HEAD have pointed over time. That makes it central to recovery workflows.
Why it matters
After operations like:
reset --hardrebasepull- branch deletion or history rewrite
the old commits may still exist, but the visible branch name may no longer point at them. Reflog helps you find those older positions.
Common examples
git reflog
git reflog show HEAD
git reset --hard HEAD@{1}
git checkout -b rescue HEAD@{2}
Best workflow
- inspect reflog
- locate the pre-mistake position
- either create a rescue branch or move the ref back
Key distinction
git logshows commit historygit reflogshows reference movement history
That difference is why reflog is so useful when normal history still exists but your pointer is no longer where you expected.
Explains why git revert is the safe way to undo shared commits, and how it differs from reset at the history level.
Nextgit bisectUse binary search across history to locate the commit that introduced a regression, making it one of the most valuable debugging commands in Git.