Retrieving a Previously Deleted File in Subversion

Let’s say that you have deleted a file (or directory) in your checked out copy of a svn repository and then checked it in (committed your change).

You discover that you really would like to have that file back in your current version of your repo. You can either us the svn merge command, or copy the file from a previous version of your repo.

Here is how you can copy the file from a previous version:

svn rm blah.txt
svn commit blah.txt -m “removed blah.txt”

(now you are at version 15)
Make a number of other commits/changes, and now you want blah.txt back from version 14.

svn cp url/to/repo/blah.txt -r14 blah.txt
svn commit blah.txt -m “retrieved blah.txt from r14”

Leave a Reply