Need to restore a deleted branch in Subversion

I have two working copies of a Subversion repository, one of the trunk, and one of a branch I created.

I accidentally deleted the branch in a repository browser. How do I restore the branch? Is there a way to undo the most recent commit for the whole repository?


Solution 1:

Here is a solution if you are using TortoiseSVN:

  1. In the repo browser, navigate to the parent folder of the folder you deleted (e.g. "branches").
  2. Right click on the folder and do a "Show Log."
  3. Find the revision where you deleted the specific branch folder.
  4. Select the revision immediately before that revision.
  5. Right click and choose "Browse Repository." You are now looking at the state of the repository at the point in time right before you deleted the branch.
  6. Find the branch folder that you deleted, select, right-click, and choose "Copy to..."
  7. You can now copy the deleted folder to either a new name or even the same name.

Solution 2:

Use:

svn cp [path to deleted branch]@[revision before delete] [new path]

For example:

svn cp svn://myrepo.com/svn/branches/2.0.5@1993 \
       svn://myrepo.com/svn/branches/2.0.5_restored

Where 1993 is the revision before the delete...

Here is some good documentation...

There must be some way of escaping the @ symbol in the username...