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:
- In the repo browser, navigate to the parent folder of the folder you deleted (e.g. "branches").
- Right click on the folder and do a "Show Log."
- Find the revision where you deleted the specific branch folder.
- Select the revision immediately before that revision.
- 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.
- Find the branch folder that you deleted, select, right-click, and choose "Copy to..."
- 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...