svn : how to create a branch from certain revision of trunk

前端 未结 4 566
盖世英雄少女心
盖世英雄少女心 2020-12-22 18:40

The following action will only create a branch from the head revision of the trunk. How do I create a branch from a specific revision? Thanks.

$ svn copy ht         


        
4条回答
  •  梦毁少年i
    2020-12-22 18:54

    Check out the help command:

    svn help copy
    
      -r [--revision] arg      : ARG (some commands also take ARG1:ARG2 range)
                                 A revision argument can be one of:
                                    NUMBER       revision number
                                    '{' DATE '}' revision at start of the date
                                    'HEAD'       latest in repository
                                    'BASE'       base rev of item's working copy
                                    'COMMITTED'  last commit at or before BASE
                                    'PREV'       revision just before COMMITTED
    

    To actually specify this on the command line using your example:

    svn copy -r123 http://svn.example.com/repos/calc/trunk \
        http://svn.example.com/repos/calc/branches/my-calc-branch
    

    Where 123 would be the revision number in trunk you want to copy. As others have noted, you can also use the @ syntax. I prefer the clearer separation of the revision # from the URL, personally.

    As noted in the help, you can replace a revision # with certain words as well:

    svn copy -rPREV http://svn.example.com/repos/calc/trunk \
        http://svn.example.com/repos/calc/branches/my-calc-branch
    

    Would copy the "revision just before COMMITTED".

提交回复
热议问题