SVN合并分支到主干的问题
我有一个主干(A)和两个分支(B 和 C)。当我将A与C合并时,就可以了,在我将A与B合并后,之前的C将被覆盖,并且我的主干没有C更改。
我想要的是 A + B + C 合并后进入主干。
编辑更多解释:
- 在主干中我有 3 个文件:“FILE 1”、“FILE 2”和“FILE 3”;
- 我从主干创建一个分支作为“Branch 1”;
- 我切换到“Branch 1”,将错误修复到“FILE 1”文件中并提交;
- 同时,另一个人从主干创建一个分支作为“分支2”;
- 此人将另一个错误修复到“FILE 2”和“FILE 3”文件中并提交;
- “Branch 2”被批准发布,然后我将“Branch 2”合并到“trunk”(可以);
- 第二天,“分支 1”获得批准,然后我将“分支 1”合并到“主干”,“主干”丢失“分支 2”的更改。
I have a trunk (A) and two branches (B and C). When I merge A with C its OK, after I merge A with B, the previous C its overwriten and my trunk don't have the C changes.
What I want is A + B + C into trunk after merges.
Edited for more explanation:
- In trunk I have 3 files: "FILE 1", "FILE 2" and "FILE 3";
- I create a branch from trunk as "Branch 1";
- I switch to "Branch 1", I fix bugs into "FILE 1" file and commit;
- In the same time, another person create a branch from trunk as "Branch 2";
- This person fix another bugs into "FILE 2" and "FILE 3" files and commit;
- The "Branch 2" is approved for publish, then I merge "Branch 2" to "trunk" (its ok);
- In next day the "Branch 1" is approved, then I merge "Branch 1" to "trunk", and the "trunk" lose the changes from "Branch 2".
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
假设您使用的是 Subversion 1.5 或更高版本,我认为您想要将分支“重新集成”回主干,请参阅 http://blog.red-bean.com/sussman/?p=92
Assuming you're using Subversion 1.5 or greater, I think you want to "reintegrate" your branches back to the trunk, see http://blog.red-bean.com/sussman/?p=92
trunk
的工作副本svn merge -r W:X svn://branchAworkingCopy
svn merge -r Y:Z svn://branchBworkingCopy< /code>
我认为这会给你你想要的,即主干加上任一分支所做的任何更改。然而,你将不得不处理冲突。
trunk
svn merge -r W:X svn://branchA workingCopy
svn merge -r Y:Z svn://branchB workingCopy
I think this will give you what you want, which is the trunk plus any changes made by either branch. You will have to deal with conflicts, however.
你的术语不清楚。当你说“将A与B合并”时,这是否意味着你将A合并到B或B合并到A?你能准确解释一下你做了什么来创建分支,以及你如何尝试进行合并吗?此外,对于合并,您使用的 SVN 版本也很重要。
我建议你仔细阅读有关分支和合并的章节< /a> 在 SVN 书中。
基本上,当您有一个功能分支(这就是您似乎拥有的)时,您会重复将该分支合并到其中。然后 SVN 会记录您合并的修订版本,并且不会再次合并它们。当您完成分支后,将其重新集成到主干中并关闭它。
所有这些都在您的磁盘上完成,一次一个分支,解决每个分支后的潜在冲突,并检查每个步骤。 (如果由于某种原因您需要在一次签入中将更改应用到主干,您可以将分支合并到主干上的一个新分支,然后在完成后将该分支合并到主干中。)
Your terminology is not clear. When you say you "merge A with B" does that mean you merge A into B or B into A? Can you explain exactly what you did to create the branches, and how you attempted to do the merging? Also, for merging it's important which SVN version you're using.
I suggest you carefully read the chapter on branching and merging in the SVN book.
Basically, when you have a feature branch (which is what you seem to have), you repeatedly merge the branch into it. SVN then logs which revisions you merged and won't merge them again. When you're done with your branch, you reintegrate it into the trunk and dismiss it.
All this is done on your disk, one branch at a time, resolving potential conflicts after each branch, and checking in each step. (If for some reason you need to apply the changes to the trunk in one checkin, you can merge your branches into a fresh branch off the trunk and then merge that branch into the trunk when you're done.)
您希望将合并应用到工作区,而不是存储库。
或者,您可以使用 cvs,它以比 svn 更好的方式处理分支。
You want to apply the merges to your workspace, not the repository.
Alternatively you can use cvs which deals with branches in a far superior way than svn does.