Undelete Something With SVN

Posted by: jzelazny | 5 Comments »

Categorized: Hints, HOWTOs, Web Development

Ever delete something with svn (svn del) and then realize you needed it again? You can get it back by using: svn copy -r HEAD filenameyoudeleted.extension filenameyoudeleted.extension

  • svn copy is the command to get a working copy back
  • -r is short for revision. I used HEAD which will give you the latest in repository. You can specify a revision number, revision right before you committed, etc (check out svn help copy)
  • filename is what you deleted, then where it goes. I usually do something like this within the folder the file was located so you do not see any paths, but if your file was in /www/files/ you would need to specify the file path to /www/files/filnameyoudeleted.extension /www/files/filnameyoudeleted.extension

Working with SVN is a lifesaver – and this tip is gold.

Tagged: , ,

5 Responses to “Undelete Something With SVN”

  1. Andreas says:

    Nice! Just what I was after.

  2. Morgan says:

    Even easier you can use “svn revert ” to revert to the locally cached copy.

  3. Tommy says:

    Great! Very helpful.

  4. Quilt says:

    You can just do ‘svn revert ‘

  5. Anne says:

    Thanks! This was helpful.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>