I ran git clean -fd by mistake
What just happened
git clean deletes untracked files for real: no trash, no reflog. Git cannot bring them back, because it never knew them.
Potential risks
- Recovery depends on tools outside Git: the sooner, the better.
Before you run anything
- Always run git clean -n (dry run) first. Always.
Recovery steps
- 1
Look in your editor's local history
SafeVS Code (Timeline, or โLocal History: Find Entry to Restoreโ) and JetBrains (Local History) keep copies of files you opened.
- 2
Files staged at some point?
If you had run git add on them, their content may survive as dangling blobs.
Safe$ git fsck --lost-found$ ls .git/lost-found/other - 3
System backups
SafeTime Machine, Windows File History, OneDrive / Dropbox versions, a recent build or zip of the project.
These procedures are provided for information only. Read each command and adapt it to your situation before running it. Disclaimer