NetBeans 6 Local History
As I was preparing to deliver a session on "New & Cool" for NetBeans 6, I realized I didn't really understand the benefits of a new feature called "Local History" so I did some investigation. What is the real value of Local History over undo/redo? Yes the visual differences window show below is nice. But was is the real advantage?
If you delete a chunk of code, you can restore it by reverting in local history. I can easily do that with the undo. I tested saving, deleting code, saving, then adding code and saving. I expected local history to allow me to selectively undo the deleting code action while keeping my adding code action. No dice. Going back to a point in time adds back the deleted code but removes the added code.
Local History is for entire file snapshots in time. Think of it as a local SCM. You can revert to a snapshot of a file at a certain time. When is this useful? Say you are coding away when you suddenly realize that you've followed an incorrect line of thinking. You'd like to go back to where you were two days prior. Well Undo is not going to get you there. Local History saves the day! Another Huge advantage of Local History is the "Revert Deleted". Let's say you are doing some refactoring and you move major pieces of code out of a class and decide you can altogether delete the class from the project. Then you realized that you forgot to move some critical code before deleting. You can use Local History->Revert Deleted to restore every file you deleted in the project. Again Local History has saved your bacon.
You can configure the number of days Local History holds on to versions of your files in the "Options-> Miscellaneous-> Versioning-> Local History" option.