How to “undelete” a deleted folder in Subversion / TortoiseSVN?

前端 未结 6 2127
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-12 15:10

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\

相关标签:
6条回答
  • 2020-12-12 16:08

    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).

    0 讨论(0)
  • 2020-12-12 16:09

    Following on from raudi's answer which worked for me after this revision.

    Some svn clients might need the revision number specified using the -r revision parameter instead of using @ after the folder as follows:

    svn copy svn://svnserver/project/tags svn://svnserver/project/tags **-r 998** -m "undeleted folder"
    
    0 讨论(0)
  • 2020-12-12 16:10

    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"
    
    0 讨论(0)
  • 2020-12-12 16:13

    Most of these answers will work to a degree but the correct answer is Daniel's. Do a reverse merge. That way you keep version history.

    svn merge -r R1:R2

    where R1 is the revision that you're at, and R2 is the revision that contains the deleted file/folder.

    0 讨论(0)
  • 2020-12-12 16:13

    You will need to do a reverse merge.

    For details on how to do it (and pretty much anything else you would ever want or need to do with SVN), the official book is available online.

    0 讨论(0)
  • 2020-12-12 16:16

    Goto Repository Browser of your repository, right-click on the parent folder where your deleted folder existed. Now, Show Log of the parent folder, and select the previous revision where you committed the delete operation. You'll have a list and right click on the folder from the revision info and select Update to this Revision.

    You are done

    0 讨论(0)
提交回复
热议问题