Inspect a previous HEAD state without changing refs.
Section: Recovering Branches and HEAD States
Switch to a reflog entry in detached HEAD
bash
bash
git switch --detach HEAD@{3}Explanation
A safe way to inspect old states before deciding to branch or reset.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Recovering Branches and HEAD States
Search reflog for deleted branch tips
Find likely commit hashes for branch recovery.
Restore a branch ref manually
Move a branch ref to a specific commit hash.
Restore branch to a reflog entry
Move the current branch back to a previous recorded state.
Set default reflog retention
Customize how long normal reflog entries are retained.