How to "recover" a deleted folder in Subversion / TortoiseSVN?

We accidentally deleted the "tags" folder from our Subversion repository, where we only wanted to delete one specific tag. What is the easiest way to return a tags folder?

We use TortoiseSVN as our client, and I thought that when I go to the repo browser and show the log, there will be something like โ€œundo changes from this revisionโ€, similar to what you can see in the similar dialog box of your working copy But there is no such team ...

+83
svn folder tortoisesvn
Feb 15 '10 at 10:52
source share
6 answers

Just copy the deleted folder from the previous version.

In the repository browser, click the button labeled HEAD (in the upper right corner) to show the version where your folder still exists, then right-click it and select "Copy to ..." and enter the path to where you want so that the folder is recreated (probably the same path that is already in the text box).

+101
Feb 15 '10 at 11:04
source share

for command line enthusiasts:

  • first find the version number where your removal occurred:

    svn log -v http://svnserver/path/to/folderContainingDeletedFolder 

let's say you find that the directory was deleted in revision 999 (by the way, it might be easier for you to find the version number with the svn repo browser)

  • copy the folder from minus 1 version

     svn copy http://svnserver/path/to/folderContainingDeletedFolder/deletedFolder@998 http://svnserver/path/to/folderContainingDeletedFolder/deletedFolder -m "undeleted folder" 

voila, you're done!

in your case it could be:

  svn copy http://svnserver/project/tags@998 http://svnserver/project/tags -m "undeleted folder" 
+65
May 12 '11 at 8:15
source share

Most of these answers will work to some extent, but the correct answer is Daniel. Do the reverse merge. This way you keep version history.

svn merge -r R1:R2

where R1 is the revision you are in, and R2 is the revision containing the deleted file / folder.

+9
Aug 13 '12 at 1:23
source share

You will need to do the reverse merge.

More information on how to do this (and almost everything you have ever needed or need to do with SVN) is available on the official online book.

+7
Feb 15 '10 at 11:12
source share

Go to the Repository Browser your repository , right-click the parent folder where the remote folder is located. Now Show Log parent folder and select the previous revision in which you performed the delete operation. You will have a list and right-click on the folder from the revision information and select Update to this Revision .

Made by

+2
Feb 15 '10 at 10:57
source share

After a response from raudi who worked for me after this review.

Some svn clients may need the version number specified using the -r version option instead of using @ after the folder as follows:

 svn copy svn://svnserver/project/tags svn://svnserver/project/tags **-r 998** -m "undeleted folder" 
+2
Aug 04 '11 at 10:10
source share



All Articles