VS Code Local History
We all have been in the situation where you did not yet committed your files to git and suddenly you lost everything due to some destructive action you did! You start searching in your git stashes or try to recover your work with ctrl/cmd+z but without success. And then you start to panic 😱.
So how can we get out of this hopeless situation? Do we really need to switch back to an IDE that you have used in the past that has this out-of-the-box 😏? Or can VS Code do this?
VS Code Local History Extension
What I was planning to write in this tip was to point you to the VS Code extension Local History that will help you to recover your work because it keeps track of your changes. I’ve used this extension a couple of months and it supported me from time to time.
VS Code built-in Local History
But then I found out that this extension is not needed anymore because VS Code has this feature built-in! 🎉. Apparently this feature was added in VS Code 1.66.0 as you can see in the release notes. I completely missed this because I actually thought I was still using the Local History extension, while it actually was the new built-in Timeline feature 😅.
So open your command palette (ctrl/cmd+shift+p) and type in “Timeline” and you will see the option “View: Focus on Timeline View”. This will open the Timeline in your editor with all the changes that were made to the file.
VS Code can do it! 🚀