Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

We have accidentally deleted the 'tags' folder from our Subversion repository where we only intended to delete one specific tag. What is the easiest way to get the 'tags' folder back?

We use TortoiseSVN as our client and I thought that when I go to the repo browser and show log, there will be something like "revert changes from this revision" similarly to what you can see in a similar dialog on your working copy. But there is no such command there...

like image 355
Borek Bernard Avatar asked Feb 15 '10 10:02

Borek Bernard


People also ask

How do I recover deleted files from TortoiseSVN?

Getting a deleted file or folder back If you have not committed a delete operation to the repository, then use TortoiseSVN -> Revert to retrieve the file. If you have already committed the deletion: Use the log dialogue box to find out the revision of your file.

How do I revert back to old revision in TortoiseSVN?

Right click on the selected revision(s), then select Context Menu → Revert changes from this revision. Or if you want to make an earlier revision the new HEAD revision, right click on the selected revision, then select Context Menu → Revert to this revision. This will discard all changes after the selected revision.

What is revert in TortoiseSVN?

If you want to undo all changes you made in a file since the last update you need to select the file, right click to pop up the context menu and then select the command TortoiseSVN → Revert A dialog will pop up showing you the files that you've changed and can revert.

Can I delete TortoiseSVN?

Use TortoiseSVN → Delete to remove files or folders from Subversion. When you TortoiseSVN → Delete a file or folder, it is removed from your working copy immediately as well as being marked for deletion in the repository on next commit. The item's parent folder shows a “modified” icon overlay.


2 Answers

Just copy the deleted folder back from an earlier revision.

In the Repository Browser, click the button labeled HEAD (at the top-right corner) to show to a revision there your folder still exists, then right-click that folder and select "Copy to..." and enter the path there you want the folder to be re-created (probably the same path that is already in the text box).

like image 113
Mikael Sundberg Avatar answered Oct 22 '22 02:10

Mikael Sundberg


for the command line enthusiasts:

  • first find the revision number where your delete happened:

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

say you find that the directory was deleted in revision 999 (btw: you might find it easier to find the revision number with the svn repo browser)

  • copy the folder from revision minus 1

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

voilà you're done!

in your case this might be:

    svn copy http://svnserver/project/tags@998 http://svnserver/project/tags -m "undeleted folder" 
like image 36
raudi Avatar answered Oct 22 '22 02:10

raudi