Today a coworker asked me if I knew how to recover a deleted file in CFEclipse. He had accidentally deleted it before putting into his source control. Since he had been working on this file recently, there is a way to recover it.

By default Eclipse keeps a local history of the files you work on. From within Eclipse, right click on a file and select Team->Show Local History.

eclipise file history

From here you will get a list of revisions, generally one is made each time you save the file. You can open a revision, or even use a built in diff tool to compare it to your current version.

eclipse history file list

But in this case we had no current version to even right click on to start the process. So we simply created a new, empty file in the same location as the old one. Then we were able to right click on it and pull up the history.

This local history is stored under your workspace in workspace\.metadata\.plugins\org.eclipse.core.resources\.history, but its not easy to manually browse. There any many directories and the files in those directories are given nonsense file names. Much easier to stick with the Eclipse interface.

Keep in mind that if you haven’t edited the file in a while there may not be any history to go to.

One Comment

  1. Mike Henke says:

    A more direct way to recover a deleted file is to right click on the project folder and select "Restore from Local History".