[英]Tortoise SVN merge two branches
i'm trying to merge two branches with tortoise SVN.我正在尝试将两个分支与乌龟 SVN 合并。 Both branches have been changed since they diverged.
两个分支自从分开后都发生了变化。 If i merge them, only the changes of one of them obtain and those of the other will be overwritten.
如果我合并它们,则只有其中一个的更改会获得,而另一个的更改将被覆盖。 But i want the latest change of every file (We have not been working in the same files).
但我想要每个文件的最新更改(我们没有在同一个文件中工作)。
I tried the option "Merge two different trees" and entered the two branches in "From:" and "To:".我尝试了“合并两个不同的树”选项,并在“From:”和“To:”中输入了两个分支。 I took the Head Revision on both.
我对两者都进行了头部修订。 I left everything else to default (Merge depth: Working Copy, Compare whitespaces, everything else unchecked)
我将其他所有内容保留为默认值(合并深度:工作副本,比较空格,其他所有内容均未选中)
In the From URL
option, you should specify the branch to which you want to merge.在
From URL
选项中,您应该指定要合并到的分支。
For example, assume that there are 2 branches, branch A
and branch B
, and you want to merge branch B
to branch A
.例如,假设有 2 个分支,分支
A
和分支B
,并且您想将分支B
合并到分支A
。
Merge
option and then select Merge two different trees
option.Merge
选项,然后选择Merge two different trees
选项。From URL
, please mention URL of branch A
and in the To URL
, mention URL of branch B
.From URL
,请提及分支A
的To URL
,在To URL
,请提及分支B
URL。 This should merge branch B
to branch A
without losing any files.这应该将分支
B
合并到分支A
而不会丢失任何文件。
Merging in Subversion is always done locally .在 Subversion 中的合并总是在本地完成。 The branch you want to merge to should be checked out with a clean checkout.
您要合并到的分支应该使用干净的检出方式检出。 That is, it should be up to date with no local changes.
也就是说,它应该是最新的,没有本地更改。 You then merge the other branch into it and commit your changes.
然后将另一个分支合并到其中并提交更改。
A Merge is not a duplicate of a particular branch.合并不是特定分支的副本。 Merging is usually a three way operation.
合并通常是一种三向操作。 You have the branch you're merging into (called yours ) the branch you're merging from (called theirs ), and the last common ancestor (LCA).
您有要合并到的分支(称为yours )、要合并的分支(称为theirs )和最后一个共同祖先(LCA)。 That last one is important.
最后一点很重要。
If a change took place on your branch, it's not touched during the merge process.如果您的分支发生更改,则在合并过程中不会触及它。 The merge algorithm knows this because there's a difference between yours and the LCA.
合并算法知道这一点,因为您的算法和 LCA 之间存在差异。 If there is difference between the LCA and theirs , that's considered for a change.
如果 LCA 和他们的 LCA 之间存在差异,则考虑进行更改。
If I understand you have:如果我明白你有:
branch1
was taken from trunk. branch1
取自主干。branch2
was taken from branch1
. branch2
取自branch1
。 What are you trying to merge?你想合并什么? Do you want to merge both
branch1
and branch2
into trunk.是否要将
branch1
和branch2
合并到主干中。 This should be possible if you copied trunk
into branch1
through Subversion and copied branch1
into branch2
through Subversion.如果您通过 Subversion将
trunk
复制到branch1
通过 Subversion将branch1
复制到branch2
这应该是可能的。 This way, Subversion knows that the two branches are related in their history.这样,Subversion 就知道这两个分支在它们的历史上是相关的。
If you created the branch, used Windows to copy the files, and added the files, you have no history between the two branches, and merging is more difficult.如果您创建了分支,使用 Windows 复制文件并添加了文件,则两个分支之间没有历史记录,合并会更加困难。
Is it okay to merge the changes of branch2
into branch1
?可以将
branch2
的更改合并到branch1
吗? If so, I'd do something like this:如果是这样,我会做这样的事情:
branch2
branch2
branch1
into branch2
and commit those changes.branch1
到branch2
并提交这些更改。 branch2
will have all the changes in branch1
. branch2
将在所有的变化branch1
。trunk
trunk
branch2
into trunk
.branch2
合并到trunk
。 Trunk will now have all the changes in both branch1
and branch2
. branch1
和branch2
进行所有更改。" Merge two different trees " option is useful when you're trying to make one branch look exactly like another branch.当您尝试使一个分支看起来与另一个分支完全相同时,“合并两个不同的树”选项很有用。
If instead you want your output branch to contain changes from both the branches, you should use the " Merge a range of revisions " option.相反,如果您希望输出分支包含来自两个分支的更改,则应使用“合并修订范围”选项。
Steps to use the Merge a range of revisions option:使用合并一系列修订选项的步骤:
Note: output branch
refers to the branch you want to merge your changes into.注意:
output branch
是指您要将更改合并到的分支。 While input branch
refers to the branch whose changes you want to merge in the output branch而
input branch
指的是你想在输出分支中合并其更改的分支
output branch
output branch
的干净工作副本input branch
input branch
input branch
.input branch
的所有修订,请选择“所有修订”。 If you want to merge specific revisions only, select 'specific range' and use the 'Show log' button to choose the revisions.output branch
output branch
For further details refer to TortoiseSVN Docs on Merging有关更多详细信息,请参阅TortoiseSVN Docs on Merging
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.