How to merge branch back to trunk in SVN with all commit history?

后端 未结 5 581
长情又很酷
长情又很酷 2021-01-30 17:32

How to merge branch back to trunk in SVN with all commit history? I know in Git I can use

merge -squash

Is there any equivalent command in SVN?

5条回答
  •  广开言路
    2021-01-30 18:07

    With Subversion 1.5 or later the merge is recorded on your local working copy in the svn:mergeinfo property. So this information is not lost.

    You can see the merged revisions if you use svn log -g instead of the normal svn log.

    Normal merges are performed as

    svn merge -rREV1:REV2 svn://server/branch my_trunk_wc 
    

    But if you use a branch it is sometimes more convenient to use a reintegration merge. In this case you should first merge all trunk changes to the branch using something like

    svn merge svn://server/trunk my_branch_wc
    

    (This merges everything that is not already merged)

    And after you commit this change to the branch you can use

    svn merge --reintegrate svn://server/branch my_trunk_wc
    

    To move all changes over as a single commit. (After this operation you should remove the branch)

提交回复
热议问题