这里针对1.7版本的svn。
merge是svn命令中比较麻烦的一个,所以特别记录一下。
下面链接有一个gui使用的例子:
http://blog.csdn.net/keda8997110/article/details/21813035
命令行的例子如下:
http://svnbook.red-bean.com/nightly/zh/svn.branchmerge.basicmerging.html#ftn.idp7707344
保持分支同步,从主干合并修改到分支:
$ pwd /home/user/my-calc-branch $ svn merge ^/calc/trunk --- Merging r345 through r356 into '.': U button.c U integer.c $
$ svn status M . M button.c M integer.c $
$ svn commit -m "Merged latest trunk changes to my-calc-branch." Sending . Sending button.c Sending integer.c Transmitting file data .. Committed revision 357. $
重新集成分支,和并分支修改到主干:
$ pwd /home/user/calc-trunk $ svn update # (make sure the working copy is up to date) At revision 390. $ svn merge --reintegrate ^/calc/branches/my-calc-branch --- Merging differences between repository URLs into '.': U button.c U integer.c U Makefile U . $ # build, test, verify, ... $ svn commit -m "Merge my-calc-branch back into trunk!" Sending . Sending button.c Sending integer.c Sending Makefile Transmitting file data .. Committed revision 391.
$ svn delete ^/calc/branches/my-calc-branch \ -m "Remove my-calc-branch, reintegrated with trunk in r391." Committed revision 392.
svn各个版本改进:
http://subversion.apache.org/docs/release-notes/1.5.html#merge-tracking
Merge tracking (foundational) (client and server)
Merging changes from (say) trunk to a branch no longer requires that you specify the revision range. Instead, each time you want to sync up with trunk, you can just do:
$ cd BRANCH_WORKING_COPY $ svn merge URL_TO_TRUNK
Subversion will figure out what changes from URL_TO_TRUNK have not yet been merged and pull in just those changes. When it's time to merge the branch back to trunk, do this:
$ cd TRUNK_WORKING_COPY $ svn merge --reintegrate URL_TO_BRANCH
This section is currently incomplete, please help write it! See the design notes for more information.
$ svn SUBCOMMAND ^/ $ svn SUBCOMMAND ^/PATH
During merges which merge all eligible revisions from another branch, Subversion 1.8 will automatically decide whether or not the merge is reintegrating a branch. Therefore, reintegrating a branch does no longer require the --reintegrate option for correct operation.
The --reintegrate option of svn merge is now deprecated and its use is discouraged. To reintegrate a branch, have a clean working copy of trunk and run the following command in its top-level directory:
$ svn merge ^/branches/my-branch