Development Tips & Tricks

NetBeans Local History to the rescue

I did not realize the power of git reset. If you need to do a git reset on your working copy and you have modified (tracked, but uncommitted) changes, then git reset will blow away all your changes without warning.

To recover your changes:
If your IDE doesn’t do local backups, then your changes are lost forever. However, if you use NetBeans IDE, then you should have no problem recovering your lost changes. Ever since NetBeans version 6.x, by default it keeps 7 days work of file changes.

In order to view your file’s local history, make sure the file is open and click Team -> Local History -> Show Local History. NetBeans should give you a diff breakdown of your current file with previous timed snapshots. Once you find the snapshot you want, right click the date and choose Revert from History.

Hope this helps!!