Mar16
2007

It would appear that Subversion does not support a direct “undelete” command so here is one way to recover/undelete a file that was previously removed from a Subversion repository. The 955 is the version of the repository where the file last existed.

$ svn cp -r 955 http://svn.domain.com/reponame/pathtofile/foo.bar foo.bar
A foo.bar
$ svn commit -m "Undeleted this file" foo.bar

Best of luck!

3 Responses to “Undeleting a file in Subversion”

  1. Michael Murphy Says:

    Never trusted subversives !!

  2. Jared Grippe Says:

    There is a better way to restore a deleted file or directory that will maintain the history of the file(s) in the repo

    svn copy –revision 1608 http://repo.example.com/project/target http://repo.example.com/project/target

    that command will restore the target file or directory in to the same location as it was in revision 1608

  3. Gary S. Says:

    Thanks for the post, and thanks for Jared’s comment. Jared’s way worked for me to undelete a directory.

Leave a Reply

Calendar

March 2007
M T W T F S S
« Feb   Apr »
 1234
567891011
12131415161718
19202122232425
262728293031