'How do I restore deleted code inside a file? [closed]
I'm using autosave in vscode and I accidently deleted important code and I can't restore it anymore even using CTRL + Z Is there any solution to restore the lost code?
Solution 1:[1]
If it is no longer possible with CTRL + Z and you have not initiated a version software for your project, it is no longer possible to reconstruct the code.
An unlikely case would be if you have not yet saved the file you have edited, the original code would at least still be contained in the file. But I guess that's not the topic here because you use autosave.
Solution 2:[2]
Is your project perhaps under version control? If yes, you could grab the missing code from the previous state of the project. If not, I suggest you look into code version control systems, mainly git (https://en.wikipedia.org/wiki/Git), it will prevent similar situations from arising in the future, plus it enables multiple people to work on the same code.
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 | Maik Lowrey |
| Solution 2 | Nick Aliferopoulos |
