TFS 2010:如何使用相同名称但不同源分支重新分支?
我最近加入的团队具有以下 TFS 分支结构(抽象):
- Main
- Foo 从 Main
- Bar 分支 从 Foo 分支
我需要删除 Bar 并直接从 Main 重新分支,而不是从 Foo 重新分支。我不需要维护 Bar 中现有的修订历史记录。
看似合乎逻辑且简单的做法是简单地删除 Bar 并将其重新创建为 Main 的分支,但是我遇到了 来自 TFS MVP 之一的博客文章,表明删除/重新创建分支使用相同的名字是不好的ju-ju。
那么……我该怎么办?有没有办法在不删除分支的情况下重新定位分支?值得注意的是,由于各种原因,Bar 分支的名称需要保持不变。
The team I recently joined has the following TFS branch structure (abstracted):
- Main
- Foo branched from Main
- Bar branched from Foo
I need to blow away Bar and essentially re-branch it directly from Main, rather than from Foo. I do not need to maintain the existing revision history in Bar.
The seemingly logicial and simple thing to do would be to simply delete Bar and re-create it as a branch from Main, however I ran across a blog post from one of the TFS MVPs indicating that deleting/re-creating a branch using the same name is bad ju-ju.
So... what should I do? Is there a way to re-target a branch without deleting it? It's worth noting that the name of the Bar branch needs to stay the same, for various reasons.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 TFS 中重新定位分支并不容易。我认为与其他 VCS-es 相比,TFS 中的分支和合并非常非常有限。
我们曾多次按照您所描述的方式进行操作,但没有发现任何问题。但是,我不能保证您会避免这些问题。是否可以选择迁移到另一个 TFS 项目?然后你可以将 Main 合并到新项目中,并在那里分支出一个新的“Bar”?
可能不是一个选择...
Re-targeting branches is not easily done in TFS. I think branching and merging is very, very limited in TFS compared to other VCS-es.
We have on several occations done what you are describing, without noticing any problems. However, I cannot guarantee that you will avoid the problems. Is moving to another TFS project an option? Then you can merge Main to the new project, and branch out a new "Bar" there?
Probably not an option...
如果你想保留 bar,但改变它与 main 的关系,你有几个选择,你可以重新设置分支的父级。首先,您需要从 main 到 bar 进行无基础合并
Tf merge /baseless $/teamproject/main $/teamproject/bar
签入待处理的更改。
一旦主分支和小分支具有合并关系,您就可以在源代码管理资源管理器中重新设置分支的父级。右键单击栏,选择“分支和合并”,然后选择“重新父级”。您现在应该能够选择 main。请参阅此博客了解更多信息。
如果历史记录不重要,那么您可以“销毁”分支而不是删除它。这应该可以避免您提到的博客中描述的问题。使用“tf destroy $/teamproject/bar”命令行。
顾名思义,破坏是永久性的,因此使用时要格外小心,一旦破坏了分支,那么重新分支就不会有任何问题。
You have a couple of options, if you want to keep bar, but change it's relationship with main you could reparent the branch. First you need to do a baseless merge from main to bar
Tf merge /baseless $/teamproject/main $/teamproject/bar
Check in the pending changes.
Once the main and bar branches have a merge relationship you can reparent the branch in source control explorer. Right click on bar, select "branching and merging" and then "reparent". You should now be able to select main. See this blog for more information.
If the history isn't important then you could "destroy" the branch rather than deleting it. This should avoid the issues described in the blog you mentioned. Use the "tf destroy $/teamproject/bar" command line.
As the name suggests destroy is permanent so use with extreme care, once you've destroyed the branch then you shouldn't have any problems re-branching.