I’m using Version Control Systems like Git and SVN on a daily base. Because this gives me the opportunity to revert my changes and go back in time in my project. A VCS is incredible useful as well if I have deleted files or settings: restoring it is just a matter of a few mouse clicks.
But even without using a VCS, Eclipse has a built-in simple version control system: the Local History.
I touched on the Local history already in earlier posts, as in Eclipse Local History & Quick Diff or Compare and Merge with Eclipse.
Restore from Local History
If I delete a file or folder from my project, I get this dialog:
That file does not go into the normal Windows Recycle Bin. Instead, Eclipse has its own recycle bin, called the local history. To restore a deleted file, I use the context menu on a project folder and select ‘Restore from Local History…’:
This opens a dialog where I can select what exactly I want to restore:
💡 The Local History is not only useful to restore files: it can restore any changes or edits in a resource too.
Local History Configuration
Unlike a full VCS, the capability of the Local History is limited to size of it. The size of the local history is configured under the menu Window > Preferences > General > Workspace > Local History:
💡 The local history can get rather large, depending on the settings. If you want to have a look, then see the .metadata\.plugins\org.eclipse.core.resources folder inside your workspace which can grow up to several hundreds of MBytes. And if the local history is too big, this might slow down the exit of Eclipse, as Eclipse is compacting that information at that time.
What is not covered
The local history is stored based on the project, and the ‘Restore’ operation needs to be performed on the project folder. So this means: if you delete the project itself, you really loose it:
So you have been warned 🙂
Summary
Undoing changes in Eclipse with the Local History is incredible useful. I just need to keep in mind that this does not work for deletion of a whole project, and that I need to keep an eye on the size of the history for performance reasons. But with the typical settings to have a history for a few days, that works very well.
Happy Restoring 🙂
You saved my life!! Thank you very much!!
LikeLike
Glad to hear that it was helpful for you, and thanks for letting me know.
LikeLike
Please save my life too ….. http://stackoverflow.com/questions/23191960/many-classes-and-xml-files-doesnt-appear-in-work-space-pls-help-me-android
LikeLike
Is the problem that files does not show up in the Projects view, but they are still on disk?
And as you have backups, can you go back to a previous version to see what the differences are?
LikeLike
Hello Erich,
I have learned a lot from your articles (mostly relating to NXP boards) – but today you saved my day! Thank you very much!1
LikeLiked by 1 person
You are welcome! Thanks for that positive feedback 🙂
LikeLike