FileFix Ultimate
English

How to recover a deleted source code or project folder

Deleted source code is usually easiest to recover from somewhere other than the disk: a git remote, the local repository, or your editor's local history. A disk scan comes last, because plain text files have no reliable signature, so they come back with their names only when the file system records still exist.

Last updated:

What to do right now

  1. Check the Recycle Bin, then clone the repository again if it was pushed to a remote.
  2. If the .git folder survived, use git restore, git reflog and git stash to bring back files and commits.
  3. For uncommitted work, check VS Code Timeline or JetBrains Local History before scanning the drive from USB.

Step by step

  1. Stop builds and check the Recycle Bin

    Do not run package installs, builds or tests on that drive, because they write thousands of files. Look in the Recycle Bin first: deleting from File Explorer or many IDEs usually goes there, while commands such as rm -rf, del, Remove-Item or git clean bypass it.

  2. Clone again from the remote

    If the project was pushed to GitHub, GitLab or another server, clone it again into a new folder. Everything that was committed and pushed comes back exactly. What remains missing is local work that was never pushed.

  3. Use git if the .git folder survived

    If only some files were deleted, git status lists them and git restore followed by the path usually brings back their last committed version. After a mistaken git reset --hard, git reflog shows earlier commits you can return to. Check git stash list for work you put aside. Files that were staged with git add but never committed can sometimes be found with git fsck --lost-found.

  4. Check the editor's local history

    In VS Code, open the Timeline view for a file; local history entries are kept separately from the project. For a deleted file, creating an empty file with the same path often makes its earlier entries appear. In JetBrains IDEs, right-click the project folder and open Local History, then Show History, where deleted files are listed and can be reverted.

  5. Scan the drive for the folder

    Run the portable FileFix Ultimate from a USB stick, open Deleted file recovery, choose the drive and start the Balanced scan. Browse the folder tree to the project path, or filter by extensions such as cs, py, js, ts or java. Skip dependency and build folders; they can be regenerated.

  6. Save elsewhere and verify the code

    Save the recovered folder to a different physical disk. Open it in a new location, run the build and tests, and compare against the remote with git diff, since a file that came back partly overwritten may still look plausible at first glance.

Why git usually beats a disk scan

The .git folder holds every committed version of every tracked file in compressed form. As long as it exists, locally or on a remote, committed code is not really lost: restoring it is a matter of the right command. That is also why deleting a project folder that contained .git hurts more than deleting a few files, since the history went with it unless it was pushed.

Uncommitted changes are different. Git never saw them, so the realistic sources are editor local history, editor backups of unsaved tabs and the disk itself. FileFix Ultimate's unsaved file finder also looks for VS Code and Notepad++ backup copies, which can hold code from tabs that were open when the editor closed.

What a recovery scan can and cannot do with source files

Photos and documents begin with a recognisable header, so a signature search can find them even when the file system has forgotten them. Source code is plain text with no such header. For code, recovery depends on the file system records: when the NTFS entries for the deleted folder survive, names, paths and folder structure come back together; when they are reused, the text files are effectively unfindable.

Very small files on NTFS are often stored inside their file record itself, which is why short configuration and source files sometimes survive when larger ones do not. Binary assets in the project, such as images, archives or SQLite databases, can still be found by signature, but without their names.

Projects inside WSL or virtual machines

Code kept inside WSL 2 lives in a virtual disk file, usually named ext4.vhdx, that holds an ext4 file system. Run wsl --shutdown, copy that file to another disk and open the copy; FileFix Ultimate can open VHDX images and read ext4 read-only. Files deleted inside ext4 are harder to restore with names than on NTFS, so treat this as a chance rather than a sure route. VMDK, VHDX and QCOW2 disks from virtual machines can be opened the same way.

When it won't work

  • Most development machines use an SSD with TRIM, which can erase deleted files almost immediately; uncommitted code may then be gone for good.
  • If a package install or build ran on the same drive after the deletion, the free space was likely reused.
  • Without surviving file system records, plain text source files cannot be found by signature.
  • Work that was never committed, pushed or captured by editor history has no copy to return to once the disk space is overwritten.

How FileFix Ultimate helps

  • No recovery limit and free for personal use, with a portable version that runs from USB so nothing new is written to the development drive.
  • Rebuilds deleted folder trees from NTFS, FAT32 and exFAT records, keeping file names and paths where those records still exist.
  • Finds VS Code and Notepad++ backups of unsaved editor tabs with the unsaved file finder.
  • Opens VHDX, VMDK and QCOW2 images and reads ext4 read-only for code kept in WSL or virtual machines.

FileFix Ultimate is free for personal use, works offline and never writes to the drive you are recovering from. Business use needs a one-year licence per PC. Check the signature before you run it.

Frequently asked questions

I ran git reset --hard. Can I get my commits back?

Usually yes. Run git reflog, find the commit from before the reset and create a branch on it or reset to it. Changes that were never committed are not in the reflog; only staged ones may be found with git fsck.

Does git clean move files to the Recycle Bin?

No. git clean deletes untracked files directly, so they do not appear in the Recycle Bin. Editor local history or a disk scan are the remaining options.

Should I recover node_modules and build folders too?

No. They are generated from the project files and the lock file, so it is faster and safer to reinstall them after the source is back. Leaving them out also makes the recovery smaller and quicker to check.

Will the recovered files keep their names and folders?

When they are found through the file system records, yes. Source files cannot be found any other way, so a file that appears at all in the folder tree usually appears with its name.

Share this page