This is the "Oh my goodness you saved my sanity" tip.
Sometimes you are in a project that's isn't yet under version control. Or, you've done a lot of work since your last commit.
Then, disaster strikes...you make a big change, or delete a chunk of code,
Undo is too far away (too much has been typed in) to help.
Or worse, you deleted a file. Oh, that sinking feeling.
Local History to the rescue. Our IDEs have a built-in facility that tracks
revisions for all IDE-initiated changes. On a file,
Show History brings up
a listing of changes on the left. On the right, a diff for the selected
change compared to the current file. You can apply parts of the diff or
right-click on the change to "revert" the current contents to the contents
at that revision.
If you selected a directory and opened
Show History, it shows file changes,
including deletions and can thus revert a delete by right-clicking on the
change that did the delete.
By default changes are retained for 5 days, but this is configurable.
Local History has more features, such as applying labels to simulate
branches and generating patches. It isn't a replacement for a VCS, but it is
very helpful when disaster strikes.