将分支合并到主干

将分支合并到主干

本文介绍了TortoiseSVN 将分支合并到主干的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是这个问题的延续:TortoiseSVN 将分支合并到主干如果最初的问题应该被编辑,请告诉我,我会这样做.

This is a continuation of this question: TortoiseSVN merging branch to trunkIf the original question should just be edited, please let me know and I'll do that.

这是目前的情况.

在我的 PC 上有一个包含最新版本的工作副本的项目.我在此基础上创建了一个新分支,并将我的工作副本切换到这个新分支.

Have a project with a working copy on my PC that was all up to date. I created a new branch based on that and switched my working copy over to this new branch.

从那以后,另一位开发人员检查了主干的一些更改,我也对分支进行了一些更改.我认为我们没有更改相同的文件,所以我们应该在任何冲突方面做得很好.

Since doing that another developer checked in some changes to the trunk, and I've made some changes to the branch. I don't think we've changed the same files so we should be good as far as any conflicts go.

我想将我的更改合并回主干.

I want to merge my changes back into the trunk.

我选择合并,然后选择合并修订范围.要合并的 URL 我选择了主干.范围为空.当我进行测试合并时,它似乎正在添加曾经添加到项目中的每个文件 - 它肯定会添加更多文件,然后自我从主干分离以来发生了变化.当应该只更改 10 或 20 个文件时,它正在处理数百个文件.

I select merge, and then select merge a range of revision. URL to merge from i have the trunk selected. Range is blank. When i do a test merge it appears to be adding every file ever added into the project - it's certainly adding way more files then have been changes since i split off from the trunk. It's doing hundreds of files when there should just be 10 or 20 files changed.

我应该选择其他开发人员签入主干的修订范围吗?或者我应该选择合并两个不同的树"?如果我尝试这样做并尝试从主干到我的分支进行测试合并,则会发生冲突.如果我尝试从我的分支到主干做,它看起来像它工作.尽管那时我想将所有内容都推回主干,因为我已经在我的分支中做了一些修复,我想在继续对分支进行任何更改之前将这些修复包含在主干中.

Should i instead select the range of revisions that the other developer checked in to trunk? Or should i instead be selecting 'merge two different trees' ? If I try that and try doing a test merge from trunk to my branch i get a conflict. If i try doing from my branch to trunk, it looks like it works. Although I would then want to push everything back to trunk at that point since I've made some fixes in my branch that i want to include in the trunk before I proceed with any more changes in the branch.

编辑:更多细节以帮助清晰当前设置

edit: a little more detail to help clarity the current setup

我的工作副本以前是主干的一部分.我使用乌龟创建一个新分支并将我的工作副本切换到该分支.所以这个项目看起来像:/project/branches/mybranch

My working copy was previously part of the trunk. I used tortoise to create a new branch and switched my working copy to that branch. So the project looks like:/project/branches/mybranch

树干看起来像/项目/主干

trunk looks like/project/trunk

另一位开发人员检查了主干中的一些更改,而我检查了 mybranch 中的一些更改.在我对 mybranch 做更多工作之前,我想将所有这些更改合并回主干.当我查看 mybranch 的日志时,只有 3 个签入;153、154和159(而153只是分支的创建)当我查看主干的日志时,有 4 个,因为它是从主干中分离出来的:155-158

Another dev checked some changes into trunk, and i've checked some changes into mybranch. I want to merge all those changes back into trunk before i do any more work on mybranch. When i view the log for mybranch, there's only 3 checkins; 153, 154 and 159 (and 153 is just the creation of the branch)when i view the log for trunk there are 4 since it was split from the trunk: 155-158

应该没有冲突,因为我们没有处理相同的文件.

There should be no conflicts as we did not work on the same files.

如果我尝试从 mybranch 合并并且没有指定修订范围,它似乎正在添加项目中的每个文件.即我做了一个测试合并,它显示了数百个添加的文件.

If i try to merge FROM mybranch and do not specify a revision range, it appears to be adding every file in the project. i.e. i do a test merge and it's showing hundreds of files as added.

如果我从主干进行测试合并并指定修订版 155-158,它看起来会将主干中的所有更改合并到我的工作副本中.我想如果我这样做,我可以将所有内容都检查到 mybranch 中,此时我只需要弄清楚如何将所有内容合并回主干.

If I do a test merge FROM trunk and specify revision 155-158 that looks like it will merge all the changes from trunk into my working copy. I suppose if i do that i can then check everything into mybranch at which point i just need to figure out how to merge everything back into trunk.

以上所有内容都是使用合并一系列修订版"完成的.

All of the above was done using 'merge a range of revisions'.

如果我尝试合并两个不同的树"并尝试将 FROM trunk 合并到 mybranch(带有头部修订),我会遇到冲突.

If i try doing 'merge two different trees' and try merging FROM trunk to mybranch (with head revision) i get a conflict.

如果我尝试从 mybranch 合并到主干,它看起来很有效.

If i try merging FROM mybranch to trunk, it looks like it works.

据我所见,从 mybranch 到主干的树合并似乎是我想要做的.我只是不确定,因为到目前为止我一直被告知不这样做.

From what i have seen, it looks like doing the tree merge from mybranch to trunk is what i want to do. I'm just not certain since so far i've been told to do otherwise.

我想把所有东西都塞进后备箱.我计划对 mybranch 中的代码进行大量更改,这将破坏项目直到项目完成,这就是为什么我希望主干在我开始之前是最新的,以防我需要修复任何现有代码.

I want everything pushed into trunk. I plan on making large changes to the code in mybranch which will break the project until it's finished, which is why i want trunk to be up to date before i start on that, in case i need to fix any existing code.

edit2:当我进行修订的合并范围并选择 mybranch 作为要合并的 url 时,这就是乌龟窗口中显示的命令:命令:将/branches/mybranch 的修订版 1-HEAD 合并到 C:\Users\xxxx\Documents\Visual Studio 2010\Projects\MyProject,尊重祖先,仅测试

edit2: when i do a merge range of revisions and select mybranch as the url to merge from, this is what shows up in the tortoise window as the command:Command: Merging revisions 1-HEAD of /branches/mybranch into C:\Users\xxxx\Documents\Visual Studio 2010\Projects\MyProject, respecting ancestry, Test Only

我的工作副本已经在 mybranch 上.所以对我来说,这听起来像是将 mybranch 合并到我的工作副本中,它已经是 mybranch 的一部分,所以基本上它是将 mybranch 合并到自身中?

My working copy is already on mybranch. So to me this sounds like it's merging mybranch into my working copy, which is already part of mybranch, so basically it's merging mybranch into itself?

合并 FROM 主干是唯一对我有意义的事情.如果合并 FROM trunk 并选择其他开发人员签入的修订范围,则输出似乎正确.那时我只需要将它全部合并回主干.

Merging FROM trunk is the only thing that would make sense to me. And if do merge FROM trunk and select the revision range that the other dev checked in, the output seems correct. At that point then I would just need to then merge it all back into trunk.

命令:将/trunk 的修订版 154-158 合并到 C:\Users\XXX\Documents\Visual Studio 2010\Projects\myproject,尊重祖先,仅测试

Command: Merging revisions 154-158 of /trunk into C:\Users\XXX\Documents\Visual Studio 2010\Projects\myproject, respecting ancestry, Test Only

重要的修订号是:

trunk: 155-158 - 这些是其他开发人员检入trunk的修订

trunk: 155-158 - these are the revisions the other dev checked into trunk

mybranch: 153, 154 and 159. 153 是分支的创建.154 和 159 是需要合并到主干中的实际文件更改.

mybranch: 153, 154 and 159. 153 is the creation of the branch. 154 and 159 are actual file changes that need to be merged into the trunk.

我刚刚尝试的另一个命令似乎也可以执行我想要的操作,如果我从 mybranch 合并到主干并在 FROM 下指定修订版 154 或 159,在 TO(主干)下指定修订版 152.我从来没有尝试过使用当前修订版以外的任何其他内容,所以我不确定如果我与几个数字后面的修订版合并会发生什么.

The other command i just tried which also seems like it will do what i want is if i merge from mybranch to trunk and specify revision 154 or 159 under FROM and revision 152 under TO (trunk). I've never tried working with anything other then the current revision though so I'm not exactly sure what happens if i merge with a revision a few numbers back.

命令:从/branches/mybranch,修订版154到/trunk,修订版152合并到C:\Users\xxxx\Documents\Visual Studio 2010\Projects\myproject,尊重

Command: Merging from /branches/mybranch, revision 154 to /trunk, revision 152 into C:\Users\xxxx\Documents\Visual Studio 2010\Projects\myproject, respecting

感谢您对澄清正确方法的帮助.

appreciate any help on clarifying the correct way to do this.

谢谢

推荐答案

如果你想合并回trunk,那么要合并的URL就是你的branch.您从 branch 的存储库版本合并到主干的本地副本.合并完成后,您检查后备箱.

If you want merge back to trunk, then the URL to merge from is your branch. You merge from the repository-version of the branch to the local copy of trunk. When the merge is finished you check in the trunk.

更新:对于所有不想阅读下面完整评论的人:正如评论中提到的merk,有必要有行李箱的检出副本.

Update: For all who don’t want read entire comments bellow: As merk mentioned in the comments, it is necessary to have a checked out copy of the trunk.

这篇关于TortoiseSVN 将分支合并到主干的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 17:56