Recovering a deleted file in Subversion

Many times I have been looking on the Internet to find a suitable solution for this, but in the end I’ve created my own solution.

These next steps will explain how to recover a deleted file back into the HEAD revision, in a Subversion repositry.

The following example shows how to Subversion commands should be executed.

  • At first, a test environment is created:
  • Next, a certain file will be deleted:
  • Afterwards, a few more Subversion commands are executed to have some more logging and revision numbers:
  • The svn log --verbose command shows which the commit messages, revision numbers and affected path names:
  • Since in revision r15 the file file_1 was deleted, one revision less will be used to recover the file, using the svn update -r command. Beware that the file must be first renamed to a new filename and afterwards renamed to the original filename!
  • Check the Subversion logging:
  • Rename the new filename to the original filename:
  • Check the Subversion logging:
  • Comments are closed.