Git Reflog and Recovery Cheat Sheet/Restore branch to a reflog entry

Move the current branch back to a previous recorded state.

Section: Recovering Commits

Restore branch to a reflog entry

bash
bash
git reset --hard HEAD@{3}
Explanation

Strong recovery option after bad rebase, reset, or merge. Verify the target first because `--hard` discards working tree changes.

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
Recover work into a new branch
Create a new branch from a reflog entry without moving current branch yet.
OpenIn sheetbashsame section
Check out a lost commit directly
Inspect a recovered commit before deciding what to do with it.
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 sheetbash3 tag match
Show reflog as a log
Browse reflog entries using log formatting.
OpenIn sheetbash3 tag match