Fix · GitHub and Git
I lost my work after a reset or a bad command
Blocks your work
What you may see
- My commits disappeared after reset, rebase or switching branch
- Files are gone and I never pushed
Most likely cause
Git almost never deletes saved commits at once; they stay in a hidden log (the reflog) for weeks.
Check first (about two minutes)
- Stop. Do not run more commands that change files.
- Run git reflog and look for the line from before the mistake.
The fix prompt
What you type here never leaves your browser. The search runs on this page, and nothing is sent to a server or to an AI.
Kept only in this browser, on this device. Keys and passwords are removed before anything is saved.
Prompt language
Paste it into Claude, ChatGPT, Gemini or Cursor, then follow what it says.
After you tried it, did it work?
Steps
- Do not change anything yet. Run git reflog -30 and git status and show me.
- Help me find the entry from just before the mistake, and show what commit it points to (git show --stat <hash>).
- Create a branch there: git branch rescued <hash>. It changes nothing else.
- Compare rescued with my current branch and help me bring back only what I need.
Do not do this
- Do not delete the .git folder or reinstall Git.
- Do not keep working in the broken state: it makes recovery harder.
- Do not run git gc or git prune.