A tip for using Eclipse. This featured saved my work!
Yesterday, having hit a small milestone in a project I decided to move it "back to the git repo". I had previously recreated the project for a different MCU.
I set about rm'ing everything in the git repo. Copying the contents of the project from workspace. Adding, commiting and pushing all the changes to git.
It was only when I went back to eclipse, right clicked the project to remove all trace from disk and re-import from the git repo... did I notice the project path.... was already the one in the git repo.... or at least it was.
A long, "Did I just...", pause followed. Until, I broke it slowly to myself that, yes, yes indeed, I had just deleted a weeks work. Checked the git log and, yep, the last commit was a week ago.
All gone. The whole display driver I wrote, all the bug fixes, the start of message parsing. All gone.
I checked the backups, but, no, they are only backing up the git repo, the live files are on the Windows VM unbacked. So I rolled the git change back again and sat sadly looking at the work from a week ago.
It was then that I noticed Eclipse had one of it's "Local History" tabs open and is was showing history for the last 3 days. "No! Could I get this lucky?"
Yes indeed I could! I was able to not only restore the versions I had saved only a an hour ago, but I could restore entirely deleted files. Took me a careful 20 minutes to restore the deleted project entirely in Eclipse. The windows recovery task I had started hadn't found a single deleted file in that time, so I stopped it.
The trick is... you can right click a folder in a project and select "Restore from local history" and it will show all the files it's aware of that have been deleted. Once you have all the files back, you can then just go through each one and select the "latest" from it's local history. "Replace with ...." "Local history.." even shows you a diff editor while you pick one.