Reputation: 41
I have completely messed up my computer. I had used Git couple of years back and now today I had to work on a project when I started using git.
cd Desktop
git add
(forgot to mention the name of directory I wanted to add)git
command to clean
with -fd
. While I was working on my desktop I noticed my desktop folders are vanishing I closed the terminal and thought its not possible and then did git clean -fd
again .. but yeah it was happening and within minutes my desktop was empty. I again closed terminal but there was only one or two folders left and rest all was gone which included all my work, documents, 1000s of images, Music, Videos etc. Now I don't know how to retrieve it. Can it be retrieved via git or even via hardware recovery software?
Upvotes: 1
Views: 8482
Reputation: 391336
Unfortunately you're on thin ice.
The "problem" with "untracked" files and git is that git explicitly doesn't know about them. Sure, it sees them on the file system, that's why it lists them, but you have not yet told git to track these files.
As such, git has no copy of them anywhere.
Additionally, when git deletes files it issues a normal delete to the file system, not a delete to the trashcan or similar, which means that there is no easy way to bring back your files.
So here's what you need to do.
Stop using your computer right now. Go to a different computer and download an undelete tool, preferably a portable one that doesn't need installing.
The reason for this is that deleted files are not tracked by the file system any more. It does not prevent new files from overwriting the space where the old files used to be. The longer it takes from the point where you deleted the files until you restore them, the fewer files you will get back in one piece.
Put this undelete tool on a USB drive and then plug that into the computer on which you deleted the files.
Run the undelete tool and ask it to help you find files you have deleted.
Cross your fingers.
When you're done, and get back as much as you can, install some backup software. If you care enough about your files to complain when they're gone, make sure they don't get lost in the first place.
Upvotes: 4