Last Updated: February 25, 2016
·
928
· peiche

Restoring a deleted file from CVS in Eclipse

We use Eclipse and CVS for development work and version control at work. It’s a pipe dream of ours to migrate to Git, but that’s another story altogether. At any rate, I found myself needing to restore a file whose deletion had been committed, and I had no idea how to do it. As it turns out, it’s stupidly easy.

Within the package explorer, locate the containing directory for the file that had been deleted. For example, if the file in question was located at WebContent/blog/post.php, then you’d right-click (or Ctrl-click if you, like our designer, is on a Mac with a one-button mouse) on WebContent/blog/. Select Team > Restore from Repository.

Picture

The server processing time will vary. If you, like me, have many files and subdirectories, this could take a long time indeed. When it’s done, the Restore from Repository dialog will appear.

From there, you can drill down to find your deleted file. Select it to see its CVS history in the right panel. The topmost entry is the deletion, so if you check that one, the dialog will tell you “Revision is the deletion and can not be restored.” Select any of the other options to restore the file.

Picture

Click Finish and you're done. It’s that easy.