Is it possible to redo the files from explorer in VS Code?

209 Views Asked by At

I did 7-8 Ctrl+Z mistaken in explorer panel in VS Code and some files have been changed now. And it seems Ctrl+Y doesn't work in explorer to bring everything back again!

I wanted to make sure if there is anyway that I can do the opposite of those Ctrl+Zs I did in explorer?

PS: The reason I did those Ctrl+Zs was because I changed name a variable using Ctrl+Shift+H and thought by doing Ctrl+Z in explorer I can undo those name replacements but it seems I have lost a lot of codes and files!!

2

There are 2 best solutions below

3
subodhkalika On

You can use redo command: Ctrl+Shift+Z. (command+Shift+Z on macOS)

Keyboards shortcuts is customisable in VS Code.

  • Go to File > Preferences > Keyboard Shortcuts. (Code > Preferences > Keyboard Shortcuts on macOS)

  • Search for Redo in search bar.

You can find the shortcut there. Or change it if you want.

If you have used Replace all (Ctrl + Shift + H), you may need to open individual files.

P.S. You may not be able to revert if:

  • It only works if you have not closed your VS code. Once you close it, you cannot revert.
  • If you have not made any changes after Undo. Any change you make after undo you will be the latest and override your previous modifications.

I would suggest to try testing these in a new file and then apply your findings.

1
Mert Dirilik On

Unsaved files can be stored temporarily. Have you tried checking the following directories?

Windows User

 C:\Users\USERNAME\AppData\Roaming\Code\User\History
 C:\Users\USERNAME\AppData\Roaming\Code\

For Linux users they are found at

 ~/.config/Code/Backups

Insiders on macOS:

~/Library/Application Support/Code - Insiders/Backups