`git reset --hard HEAD@{5}` fails with `fatal: bad revision 'HEAD@{5}'` or `git reflog` is empty.
IntermediateTroubleshootingLost Work, HEAD and History Problems
Answer
Likely causes → Fewer than six reflog entries exist, the reflog expired or was cleared (git reflog expire, gc), it is a fresh clone (reflogs are local), or you are in a different repository or worktree.
Diagnose →
git reflog | head
git config --get core.logAllRefUpdates
git reflog show origin/main
Fix → Look at other reflogs (git reflog show <branch>), search dangling commits with git fsck --lost-found, or fetch the lost work from a teammate or backup. Use dates: HEAD@{yesterday}.
Prevent → Push work-in-progress to a private branch, and avoid running git reflog expire --expire=now --all.
More on Lost Work, HEAD and History Problems
`fatal: Unable to create '/repo/.git/index.lock': File exists.`BeginnerYou added a file to `.gitignore`, but `git status` still shows it as modified.Beginner`fatal: your current branch 'main' does not have any commits yet`Beginner`Author identity unknown *** Please tell me who you are.` and `fatal: unable to auto-detect email address`Beginner`fatal: ambiguous argument 'HEAD~1': unknown revision or path not in the working tree.`BeginnerYour commits do not show on your GitHub profile contribution graph.Intermediate