简体   繁体   中英

Restore deleted files in visual studio code in the code management menu

I am really devastated because I have accidentally deleted 3 of my files in Visual Studio Code. I did it through the Source Code Management menu on the left side. Now my question... Is there any possibility to restore the 3 files I deleted like this? I would appreciate any answer and maybe you want to know: I use Windows:-( I tried to look into the recycle bin of windows but it isn't there. :-(

No, you cannot recover those files using VS Code or standard tools. They aren't put in the recycling bin (or your operating system's equivalent), they are removed using git clean or git reset --hard . Condolences :-(

There are of course utilities for recovering deleted files that may or may not be successful, but that is outside the scope of this question.

I accidentally removed a file that wasn't even checked in to git. Google brought me here. The file wasn't in the Trash can either (Ubuntu 18.4 VS Code 1.31.1). Looking at the git output I can see that it used git clean -f to remove it by f orce).

Fortunately the file was still in the editor. Just press Ctrl + P and type the file name. It should show up in the list of files and if you open it, it says "FILE_NAME (deleted from disk)" on the tab. Just copy/paste the content to where it should be.

vscode maintains a file-history using its latest TIMELINE view .

How to restore deleted git-untracked files in vscode:

Create the files with the same name at the same directory.

Go to TIMELINE on the File Explorer.

You can get the older versions of the files.

if you accidently click the delete menu option right below rename, as long as you don't panic and like restart your computer or something you can open that directory in the file explorer on your computer

and right click.

there should be options there to undo delete or whatever else you did to the directory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM