简体   繁体   English

如何在SVN中从分支合并到分支并再次返回(双向合并)?

[英]How to merge from branch to branch and back again (bidirectional merging) in SVN?

Using the svnmerge.py tool it is possible to merge between branches, up and down.使用 svnmerge.py 工具可以在分支之间合并,向上和向下。 It is hard to find the details for doing this.很难找到执行此操作的详细信息。 Hopefully, v1.5 will have a neat method for doing this without using svnmerge.py - details requested!希望 v1.5 将有一个简洁的方法来做到这一点,而无需使用 svnmerge.py - 需要详细信息!

It looks like you're asking about 1.5 merge tracking.看起来您在询问 1.5 合并跟踪。 Here's a quick overview for doing merges to/from trunk (or another branch): http://blog.red-bean.com/sussman/?p=92以下是与主干(或其他分支)合并的快速概述: http : //blog.red-bean.com/sussman/?p=92

With svnmerge.py, you initialize both branches (when going in one direction, you only need to initialize one of the branches).使用 svnmerge.py,您可以初始化两个分支(当朝一个方向前进时,您只需要初始化其中一个分支)。 Then merge using the -b (For bidirectional flag).然后使用 -b(对于双向标志)进行合并。 Here is a summary starting from branch one to branch two.这是从分支一到分支二的总结。 $REPO is the protocol and path to your repository. $REPO 是存储库的协议和路径。

svn copy $REPO/branches/one $REPO/branches/two \\ svn copy $REPO/branches/one $REPO/branches/two \\
-m "Creating branch two from branch one." -m "从分支一创建分支二。"
svn checkout branches/one one svn checkout 分支/一一
svn checkout branches/two two svn checkout 分支/二二

cd one svnmerge init ../two cd 一个 svnmerge init ../two
cd ../two cd ../两个
svnmerge init ../one svnmerge init ../一个

You may now edit both branches.您现在可以编辑两个分支。 Changes from one to two can be merged by:可以通过以下方式合并从一到二的更改:

cd two光盘二
svnmerge merge -b -S one svnmerge 合并 -b -S 一
svn commit -F svnmerge-commit-message.txt svn commit -F svnmerge-commit-message.txt

Conversely, changes from two to one can be merge by:相反,可以通过以下方式合并从 2 到 1 的更改:

cd one光盘一
svnmerge merge -b -S two svnmerge 合并 -b -S 两个
svn commit -F svnmerge-commit-message.txt svn commit -F svnmerge-commit-message.txt

Be sure to note the -b flag!一定要注意 -b 标志!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM