I just started coding and using VSC, and I was wondering if there was an option or add-in to take "snapshots" or "savestates" of the code before I modify it, thus far I've been doing multiple Ctrl + Z until getting back where I was.
Asked
Active
Viewed 97 times
1
-
2Use a version control system, like Git. While there may be a way to have "savestates", relying on some "magic" IDE feature to track your code's states isn't a good habit to develop especially if you're just learning coding. Once you've learned Git basics, VS Code does have UI to help you use it: https://code.visualstudio.com/docs/editor/versioncontrol – Gino Mempin Sep 05 '22 at 22:07
-
2Does this answer your question? [How can I see local history changes in Visual Studio Code?](https://stackoverflow.com/questions/46446901/how-can-i-see-local-history-changes-in-visual-studio-code) – Gino Mempin Sep 05 '22 at 22:42
-
As mentioned on the page Gino links to, take a look at VS Code's Timeline feature. It stores a snapshop of your file each time you save it. You can jump back and forth chronologically and restore from any point. – Magnus Lind Oxlund Jul 30 '23 at 08:09
1 Answers
-2
Yes, this is exactly what version control is for.
VSCode has very-well integrated support for Git, by far the most popular version control system.
If that's too heavyweight for you, you could just save copies of your source code locally before making changes. I used to do that - I'd have code1, code2, code3, etc...

nerdfever.com
- 1,652
- 1
- 20
- 41