Accidently deleted every file in Vs Code while trying to push to git, any way to recover them?
I am a complete noob so while trying to deploy one of my programs to heroku, I needed to push it to github, in Vscode while trying to do that, I got a whole bunch of files that I didn't want to upload on github, so I hit remove all from this screen
I now realize that I deleted everything and I don't know what I can do, I tried going into my drive and hitting properties to try and restore but looks like I hadn't turned that feature on. Is there anyway I can recover my files? I am on windows
Solution 1:
Simply go to your terminal and navigate to the folder you are pushing to git. You can run these commands:
git log --pretty=oneline
(Shows all previous commits)
git checkout .
(This resets everything to the previous commit)
Once you have reset your project to the previous commit, try again and delete the files you wanted to remove. Then perform the git commit -am "text here"
and git push heroku master
commands.
EDIT: This only works if you have already made git commits. If you have deleted everything and git log --pretty=oneline
does not show any commits, then there is no way to recover the deleted files.
You can also check the recycle bin of your computer to see if the deleted files are there.