'restore previous version of a saved file in vscode
TL;DR: I have saved a file, I need the previous version. What do I do?
I had had a lot of code, cut them (ctrl+x), and wanted to paste them somewhere else that VS code crashed. I opened it again, copy some other lines, and BOOM! I can't access the first cut lines. Is there any way I can have them back?
Notes:
I didn't commit them.
Because of that continues crash, I installed/uninstalled VScode 2-3 times, even installed
VS-insidersBUT I saved the PREVIOUS data files like.vscodefolder inC:\Users\UserorCodefolder underC:\Users\User\AppData\Roaming\Codedirectory, for all previous VScode installations (All are for today).I read links like this, but my files are saved. They aren't saved in that
backupfolder.VS is configured to autosave files (after a delay), so I don't press
ctrl+smanually.I have git enabled, does that help? The file is staged btw.
Solution 1:[1]
The solution is in Local History and Timeline View. It does not need version control. VSCode internally save file in .config/code/Backups in different scenarios.
If you want to go back to one of the previous states of a file, you have to use Timeline View to check the file's Local History. When you find the file, right click on it and press Restore Contents
Here is a screenshot of Timeline View of a file in my machine. However, your User Interface may not be organized like mine.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |

