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-insiders
BUT I saved the PREVIOUS data files like .vscode
folder in C:\Users\User
or Code
folder under C:\Users\User\AppData\Roaming\Code
directory, 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 backup
folder.
VS is configured to autosave files (after a delay), so I don't press ctrl+s
manually.
I have git enabled, does that help? The file is staged btw.
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.