How to restore a deleted file in svn

Posted by manuel on Jul 8, 2009 in Uncategorized, manuel |

Personally, I try not to delete files I still need. But sometimes it happens nevertheless. As this is one reason for using source control, I just get back to the command line and do a couple of svn-commands to restore the file. But restoring a file is a task so seldom necessary that I can not remember what to do. So after googling I’ve foundĀ  this blog-post. But it is not complete and a little outdated, so here is the way it has worked for me:

  • find the revision, in which the file has been deleted:
svn log –verbose
  • restore to repository.
svn cp http://repository.org/path/to/deleted/file/file.txt@rev http://repository.org/path/to/deleted/file/

Note: rev is the revison before the file has been deleted! So if svn log has shown you that the file has been deleted in revision 123, pass 122 as revision to the cp command.

Tags:

Reply

You must be logged in to post a comment.

Copyright © 2010 Virtualheadcrash All rights reserved.
Desk Mess Mirrored v1.0.8 theme from BuyNowShop.com.