Going beyond Eclipse's local file compare/replace
Originally I wanted to title this "Last night Eclipse saved my life" but decided that didn't really explain this mini guide all to well.
First off, if you are not on Eclipse than you probably don't know about two great features, "Compare with local history", and "Replace with local history". In brief, Eclipse saves all previous version of your file(s) you are working on. So with a simple click you can "Compare"/"Replace" your current version of a document to the original one you started working on 2 days ago! Think of it as a mini source control without the checking in.out. If you want to know more about these features go to Robert Blackburn write up in Fusion Authority.
What does "Going beyond Eclipse's local file compare/replace" mean then?
Let go back to the other night. Working with a set of XML documents in Eclipse and not thinking what I did I managed to delete all the files that I had been working on and worst still, they were not to be found in the recycle bin - lost forever in oblivion. Now, imagine if this happened 3 or 4 days ago and you didn't realise at the time! This is were Eclipse's next cool feature comes into play, "Restore from local history".
To restore a version of a deleted file:
- In the navigation view, right click the folder/project that your need to examin.
- From thepop-up menu, select "Restore from Local History...".
- At this point the "Local History" window opens showing all the files and folders that have been created within this project/folder. See the image below
- From first left hand panel, "Available Files In Local History", highlight/check the file(s) you want to restore.
- Once you've highlighted/checked your file the right hand side panel, "Local History of 'xx.xx'" will be populated and display a list of available versions.
- You can check multiple files to restore.
- You don't always have to use the right hand side panel. If you just want the last state of the file then just use the check box as it defaults to the last save.
- Once all done simply click Restore
In Eclipse you can specify how many days to keep files, how many entries per file, or the maximum file size for files. To do this go to Window » Preferences » General » Local History.