Development

Hidden Gems in your IDE - Local History

Yannick Rödl|
#development#productivity

Being a developer is like oscillate between joy and pain. Recently, I screwed up half a days development work. By accident, I deleted several files, that I had been working on for hours. I was very frustrated and did not want to redo all the work I have put in, as it has just been running. However, I had discovered a feature called “Timeline” in VS Code some weeks ago. “Timeline” tracks a local history of all file changes. This would be incredible, as I could restore my deleted files. The problem was, I was developing in IntelliJ IDEA.

I was curious if IntelliJ IDEA had something similar and found a feature called “Local History”. It is like a git history of all changes you have made to your project.

The great thing about it is, that it is not only tracking changes to files, but also to directories and even the project itself. It is like a time machine for your project. You can go back in time and see what you have changed. You can even compare the current state with a previous state. And the best thing is, that you do not even have to commit your changes (which you should do often). The following screenshot shows the local history of a random project in IntelliJ IDEA: Local History in IntelliJ IDEA

The local history is not only a great feature to recover lost work, but also to understand what you have done in the past and to recreate this one working version, you have had several hours ago.

In VSCode a similar feature is called “Timeline”. However, it is not as powerful as the local history in IntelliJ IDEA as it is limited to one file. Hint here: You just need to recreate a blank file with the same name and copy the content from the timeline. You can find it in the explorer view under “Timeline” at the bottom: Timeline in VSCode

Using these features allows you to restore file contents, or a project in a previous state, without the necessity of using git. You even have a diff on the file contents. Still, you should use git for version control, but the local history is a great addition to your toolset.

Back to Blog