Git Reflog and Recovery Cheat Sheet/Check out a lost commit directly

Inspect a recovered commit before deciding what to do with it.

Section: Recovering Commits

Check out a lost commit directly

bash
bash
git checkout <lost_commit_sha>
Explanation

Detached HEAD checkout is useful for verifying that a reflog-discovered commit is the one you want to recover.

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 Commits
Restore branch to a reflog entry
Move the current branch back to a previous recorded state.
OpenIn sheetbashsame section
Recover work into a new branch
Create a new branch from a reflog entry without moving current branch yet.
OpenIn sheetbashsame section
Restore a lost commit by cherry-picking it
Apply a recovered commit onto the current branch.
OpenIn sheetbashsame section
Find dangling commits and objects
List objects that are no longer reachable from refs.
OpenIn sheetbashsame section
Show reflog
List recent local HEAD and branch movements.
OpenIn sheetbash2 tag match
Create branch from ORIG_HEAD
Use ORIG_HEAD as a quick recovery anchor.
OpenIn sheetbash2 tag match