简体   繁体   English

TortoiseSVN将分支合并到主干

[英]TortoiseSVN merging a branch to trunk

This is a continuation of this question: TortoiseSVN merging branch to trunk If the original question should just be edited, please let me know and I'll do that. 这是该问题的延续: TortoiseSVN合并到主干的分支如果应该仅编辑原始问题,请让我知道,我会做。

Here's the current situation. 这是目前的情况。

Have a project with a working copy on my PC that was all up to date. 在我的PC上有一个带有工作副本的项目,该副本是最新的。 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. 我想将更改合并回主干。

I select merge, and then select merge a range of revision. 我选择合并,然后选择合并一个修订范围。 URL to merge from i have the trunk selected. 从我要合并的URL选择了主干。 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. 当只需要更改10或20个文件时,它将处理数百个文件。

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 编辑 :更多细节,以帮助澄清当前设置

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 因此项目看起来像:/ project / branches / mybranch

trunk looks like /project/trunk 树干看起来像/ project / trunk

Another dev checked some changes into trunk, and i've checked some changes into mybranch. 另一个开发人员检查了对主干的一些更改,而我检查了对mybranch的一些更改。 I want to merge all those changes back into trunk before i do any more work on mybranch. 我想将所有这些更改合并回主干,然后再进行mybranch的任何其他工作。 When i view the log for mybranch, there's only 3 checkins; 当我查看mybranch的日志时,只有3个签到; 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 153、154和159(而153只是分支的创建),当我查看中继的日志时,由于它是与中继分开的,因此有4个:155-158

There should be no conflicts as we did not work on the same files. 不应有冲突,因为我们没有处理相同的文件。

If i try to merge FROM mybranch and do not specify a revision range, it appears to be adding every file in the project. 如果我尝试从mybranch合并而未指定修订范围,则它似乎正在添加项目中的每个文件。 ie i do a test merge and it's showing hundreds of files as added. 即我做一个测试合并,它显示添加的数百个文件。

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. 如果我从主干进行测试合并并指定版本155-158,则它看起来会将所有从主干的更改合并到我的工作副本中。 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. 我想如果我可以将所有内容都检入mybranch,那时候我只需要弄清楚如何将所有内容合并回主干即可。

All of the above was done using 'merge a range of revisions'. 以上所有操作均使用“合并一系列修订”完成。

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. 从我所看到的,看来我要做的是将树从mybranch合并到树干。 I'm just not certain since so far i've been told to do otherwise. 我只是不确定,因为到目前为止,我被告知要做其他事情。

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. 我计划对mybranch中的代码进行较大的更改,这将使项目中断,直到完成为止,这就是为什么我希望在开始之前,trunk是最新的,以防万一我需要修复任何现有代码。

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

My working copy is already on mybranch. 我的工作副本已经在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? 因此,对我而言,这听起来像是将mybranch合并到我的工作副本中,而该副本已经是mybranch的一部分,因此基本上是将mybranch合并到自身中?

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. 如果合并FROM FROM trunk并选择其他开发人员签入的修订范围,则输出似乎正确。 At that point then I would just need to then merge it all back into trunk. 到那时,我只需要将其全部合并回主干即可。

Command: Merging revisions 154-158 of /trunk into C:\\Users\\XXX\\Documents\\Visual Studio 2010\\Projects\\myproject, respecting ancestry, Test Only 命令:将/ trunk的修订版154-158合并到C:\\ Users \\ XXX \\ Documents \\ Visual Studio 2010 \\ Projects \\ myproject中,同时考虑到祖先,仅测试

The revision numbers that matter are: 重要的修订号是:

trunk: 155-158 - these are the revisions the other dev checked into trunk 主干:155-158-这些是其他开发人员检入主干的修订

mybranch: 153, 154 and 159. 153 is the creation of the branch. mybranch:153、154和159。153是分支的创建。 154 and 159 are actual file changes that need to be merged into the trunk. 154和159是需要合并到中继中的实际文件更改。

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). 我刚刚尝试过的另一个命令似乎也可以满足我的要求,如果我从mybranch合并到主干,并在FROM下指定了修订154或159,在TO下指定了修订152(树干)。 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. 我从来没有尝试过使用除当前修订版之外的任何其他版本,因此我不确定如果我将修订版合并几个数字会发生什么情况。

Command: Merging from /branches/mybranch, revision 154 to /trunk, revision 152 into C:\\Users\\xxxx\\Documents\\Visual Studio 2010\\Projects\\myproject, respecting 命令:从/ branches / mybranch,修订版154到/ trunk,修订版152合并到C:\\ Users \\ xxxx \\ Documents \\ Visual Studio 2010 \\ Projects \\ myproject,

appreciate any help on clarifying the correct way to do this. 感谢您提供帮助,以澄清执行此操作的正确方法。

Thanks 谢谢

URL to merge from i have the trunk selected. 从我要合并的URL选择了主干。

If you want merge back to trunk , then the URL to merge from is your branch . 如果要合并回trunk则要合并URL是您的branch You merge from the repository-version of the branch to the local copy of trunk. 您从branch的存储库版本合并到主干的本地副本。 When the merge is finished you check in the trunk. 合并完成后,您签入中继。

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. 更新 :对于所有不想阅读以下注释的人:正如注释中提到的默克 ,有必要签出主干的副本。

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

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