Is there any method for recover deleted file with git?

63 Views Asked by At

I create a repository in the main directory of my mac for mistake. Then with gitgraph extension on vs code i see +10k file added and ready to commit, i press remove modify and now all of my files are deleted. Is there any chache to rehave them?

git status

1

There are 1 best solutions below

1
On

You say "ready to commit". I interpret this to mean that you have stage all files. In this case, the files should all be in the object database. You can access them using

git fsck --lost-found

(manual page). You only get the contents back, but not the file names. These you have to recover in some other way, for example by inspecting the contents.