如何在Team Foundation Server中将子分支提升为Trunk分支 [英] How to promote a child branch as the Trunk branch in Team Foundation Server
问题描述
在Team Foundation Server中,我们有几个子分支和一个Trunk分支.但是现在我们需要将子分支提升为Trunk分支,并丢弃当前的Trunk分支.此外,我们需要保留以前的Trunk分支和子分支的历史记录.
In Team Foundation Server we have several child branches and a Trunk branch. But now we need to promote a child branch as the Trunk branch and discard the current Trunk branch. Furthermore, we need to maintain the history of both the previous Trunk branch and the child branch.
PS:由于整个项目中的巨大冲突,我们无法合并当前的Trunk分支和子分支.
PS: We cannot merge the current Trunk branch and child branch due to huge conflicts all over the project.
请同时通过视觉表示:
Please go through the visual representation as well:
推荐答案
即使不了解整个上下文,这在您的环境中也不是一个好的分支策略.
Even without knowing the entire context, this doesn't look like a good branching strategy in your environment.
您想回到其他分支,必须先在两个分支之间设置关系.
You want to reparent to other branch, you must set a relation ship between the 2 branches first.
唯一的解决方案是无基础合并:tf merge /baseless
之后,您将在对话框中看到新的目标分支.有关更多详细信息和步骤,请参考此博客: TFS源代码控制分支的父级.
The only solution is baseless merging: tf merge /baseless
After that , you will see the new target branch in the dialog. More details info and steps please refer this blog: Reparent of a TFS Source Controlled Branch.
您也可以在以下问题中查看我的答复:将TFS父对象设为孙子
You could also take a look at my reply in this question:TFS reparent to be a grandchild
由于数量巨大,我们无法合并当前的Trunk分支和子分支 在整个项目中发生冲突.
We cannot merge the current Trunk branch and child branch due to huge conflicts all over the project.
在进行无基础合并的过程中,实际上没有更新子分支上的任何文件,设置了/discard
开关,这使我们能够在不修改子分支的情况下创建分支之间的关系.并以没有任何待合并的关系开始关系:
Without actually updating any of the files on the child branch during the baseless merge, with the /discard
switch set, has allowed us to create a relationship between the branches, without modifying the child branch and starting the relationship off with no pending merges between them:
tf merge $/Path/To/NewParent $/Path/To/Child /baseless /discard /recursive
然后,您可以简单地将子分支重新绑定到新的父分支.
You can then simply re-parent the child branch to the new parent branch.
更新
如果您只想用子分支代码替换Trunk,它不能仅仅通过合并过程来实现.例如,在合并过程中,我们无法删除仅存在于中继分支中的任何文件. (从孩子→树干)
If you just want to replace the Trunk with child branch code.It's not able to achieve this simply from a merge process. For example, we could not delete any files which only exist in trunk branch during merge process. (From child → trunk)
作为一种解决方法,您可以简单地先删除主干分支中的所有代码/文件,然后将子分支合并回主干.此后,Trunk分支将仅具有子分支代码.
As a workaround, you could simply delete all codes/files in trunk branch first, then merge child branch back to trunk. After this, the Trunk branch will only have child branch code.
如果您仍然需要主干中的旧代码,则在删除文件之前,可以创建一个新的分支调用旧主干",将主干中的代码合并到其中,并使其只读以保持跟踪.
If you still need the old code in trunk, before delete files, you could create a new branch call "old trunk", merge code from trunk to it and make read only to keep tracking.
这篇关于如何在Team Foundation Server中将子分支提升为Trunk分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!