0

Please help me! I just f***ed up everything! I was working on a angular crash course project in visual studio and then wanted to commit my changes to git so i first wanted to add my git repo to the project. But i saw that there was a error or warning showing me that there were a lot of untracked and uncommited files to git. When i saw what kind of files they were, they didn't have to do anything with my projects but were all local folders and files. I didnt understand why these files and folders were not commited and untracked since they didn't have to do anything with my project so i didn't want to commit all my private files to git. Here is where the problem begins: i did the git clean -fd command and it started to actually delete all these files from my PC. Oh God i am crying. I don't know what i did and now i don't know how to restore them. Please can you help me with this issue? I want to restore all my files and folders and basically everything. I don't know how git was was showing me my local files were not commited or tracked or something like that. I just don't have any idea. Please help me! What can i do? I am still a Junior and don't know what to do. :(((

As explained above, i wanted to commit the project i was doing to git so i wanted to add my git repo to the project.

Labi
  • 1
  • 1
  • 2
    The bad news: you can't use git to undo such `clean` command. The optimistic news: you may be able to restore your files, either by using FS recovery tools, or by using your IDE. Take a look at https://stackoverflow.com/q/6267180/2840436 – micromoses Mar 17 '23 at 00:57
  • Ideally, before you try any data recovery stuff, take a full block-level copy (NOT a backup of all the files on your computer, I mean a clone of your hard drive) with a tool such as dd so if you make it worse, you get a do-over. Avoid doing very much on the drive until you've done that, to increase the chances of recovery. – TheTechRobo the Nerd Mar 17 '23 at 01:24
  • Also, if you have a backup of your computer already, that should at least give you some of your files. – TheTechRobo the Nerd Mar 17 '23 at 01:27
  • 2
    Cautionary tale here: always use `git clean -fdn` **before** your `git clean -fd`, to read the preview of what's about to be deleted. Won't help you recover your files, though, I'm sorry. – Romain Valeri Mar 17 '23 at 08:20

0 Answers0