[Linux] Vscode connects to a remote server: accidentally deleted files, how to retrieve them

[Linux] Vscode connects to a remote server: accidentally deleted files, how to retrieve them

0. Description

If you accidentally delete a file in VS Code's sidebar, there are a few ways to try and get it back:

1. Restore file history

VS Code will keep the file history, you can try the following steps to retrieve the file:

  • Open the Command Palette: Press Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (Mac).
  • Enter "Show File History" in the Command Palette and select the command.
  • In the window that pops up, you'll see a list of recently modified files. Find the file you deleted and restore it from history.

2. Use source code version control tools

If you have used a source code version control tool such as Git, you can use it to restore deleted files. The following is a common recovery method:

  • Open a terminal, and navigate to the directory containing your project.
  • Use the appropriate Git command (such as git checkout or git restore) to restore deleted files. For example, if the file is named "example.txt", you can run git checkout example.txt to restore it.

3. Restore from Recycle Bin

If you are using a desktop environment like GNOME, KDE, etc., and the file manager you use supports the recycle bin function, you can try to restore deleted files from the recycle bin.

Note that the availability of the above methods depends on your operating system and tool configuration. If none of these methods work, the files may need to be restored from a system backup or other external source.

Guess you like

Origin blog.csdn.net/qq_51392112/article/details/131862040