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!!
That’s useful thank you I’ve been wondering how to “undo” all my modifications! 🙂
A pitty: it is only file based. How about accidentally removed files? This can happen even if you use git or any other version control system
saved me losing a chunk of work from a corrupted file save in NB. Thanks a million!
YEEES! This saved my bacon, my senior final program was corrupted on my flash drive and it was the place I had saved the file, thankfully this helped me recover all of my work after my previous save before the file was corrupted! Thank you so, so much, local file history to the rescue!