Subversion: Can I checkout, modify, and then make it a branch?

后端 未结 4 1826
离开以前
离开以前 2021-01-30 15:57

I did a checkout from my trunk to a local DIR and made lots of local changes there. Now I don\'t want to commit it back to the trunk, but I\'d rather make a branch from this loc

相关标签:
4条回答
  • 2021-01-30 16:07

    In my SVN client: TortoiseSVN it is enough to:

    • right click on the top directory I want to branch
    • in "To URL" select the branch directory in your repository
    • in the frame "Create copy in the repository from:" select "Working copy"

    done :)

    It is just like copying local version to specified repository url.

    0 讨论(0)
  • 2021-01-30 16:07

    Yes, you can do this by SVN commandline as well as tortoiseSVN.

    You have to specify your SVN workingcopy as src and your new branch as destination of the

    svn copy <file/path/to/working/copy> <URL/TO/REPOSITORY/BRANCH>
    

    command.

    In TortoiseSVN just point into your working copy, choose "Branch/tag" from contextmenu and choose "Working copy" in the section "Create copy in the repository from:"

    Note that it is not a good idea (for traceability reasons )to create tags in such a way, but for branches it is perfectly fine.

    0 讨论(0)
  • 2021-01-30 16:09

    According to its command line help svn copy can copy from a directory to a repository URL. So you should be able to copy your working copy to the branch, e.g.:

    svn copy working_directory url_to_branch
    
    0 讨论(0)
  • 2021-01-30 16:31

    The SVN Book (http://svnbook.red-bean.com/en/1.6/svn-book.html#svn.branchmerge.using.create) doesn't recommend creating a branch from the local working copy.

    While it's also possible to create a branch by using svn copy to duplicate a directory within the working copy, this technique isn't recommended. It can be quite slow, in fact! Copying a directory on the client side is a linear-time operation, in that it actually has to duplicate every file and subdirectory within that working copy directory on the local disk.

    Instead, create the branch first and then use the svn switch command so you can commit your changes. If your working copy is significantly out of date with the trunk then append "@REV" to the source URL where "REV" is the revision of your working copy reported by svn info.

    Copying a directory on the server, however, is a constant-time operation, and it's the way most people create branches.

    $ svn copy http://svn.example.com/repos/calc/trunk \
               http://svn.example.com/repos/calc/branches/my-calc-branch \
          -m "Creating a private branch of /calc/trunk."
    
    0 讨论(0)
提交回复
热议问题