在 TFS 中查找合并候选者 [英] Finding merge candidates in TFS

查看:22
本文介绍了在 TFS 中查找合并候选者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码有两个分支.让我们说 B1B2.代码更改同时发生在两个分支上,我们会定期进行从 B1B2 的合并(不是所有事情,只有必要的事情).但是,这种合并是通过将代码从一个分支复制粘贴到另一个分支来手动完成的(无论出于何种原因).现在,我想确保所有必要的东西都从 B1 合并到 B2.请注意,B2 分支中的文件可能包含除来自 B1 之外的其他更改.我尝试使用 tfs merge/candidates ... 命令希望它能够进行文件比较(可能正在使用 diff 工具)并给出输出,但这不起作用.只有当我使用 tfs merge 命令时,它才会记录合并.如果手动合并文件,是否有任何简单的解决方案可以消除误报?

I have two branches for my code. Lets say B1 and B2. Code changes happen on both the branches parallely and we do a periodic merges (not everything, only necessary things) from B1 to B2. However, this merge is done manually (for whatever reason) by copy pasting the code from one branch to another. Now, I want to make sure that all the necessary things are merged from B1 to B2. Note that the files in B2 branch may contain additional changes other than coming from B1. I tried using tfs merge /candidates ... command hoping that it will file comparison (may be using diff tool) and give the output, but that doesnt work. Only if I had used tfs merge command it will record the merge. Is there any simple solution where I can remove the false positives if the file is manually merged?

推荐答案

你可以做一个 放弃合并.这必须从命令行完成.打开开发者命令提示符,然后导航到任一分支下的文件夹(即导航到受影响的工作区).然后输入:

You can do a discard merge. This has to be done from the command line. Open up the Developer command prompt, then navigate to a folder under either of your branches (i.e. navigate to one of the affected workspaces). Then type:

tf merge /r /discard "$/Project/B1" "$/Project/B2" /v:C12345~C12345

这将采用已识别的变更集(在本例中为变更集#12345),并将其更新为合并到目标分支(分支 B2).目标文件将被检出,但不会被更改——您只需将它们检入即可完成操作.之后变更集将不再作为合并候选出现.您可以同时指定要合并的一系列变更集,但它们应该是连续的.

This will take the changeset identified (in this case it was changeset #12345), and update it as merged to the target branch (branch B2). The target files will be checked out, but they will not be changed - you can simply check them in to complete the operation. After that the changeset will no longer appear as a merge candidate. You can specify a range of changesets to merge at the same time, but they should be contiguous.

请注意,执行此操作后,变更集偶尔仍会显示为合并候选者 - 这在最新版本的 TFS 中相当罕见,并且几乎不可能修复(除非您正在运行自己的本地 TFS 安装和想要在数据库中弄脏你的手).如果您最终得到这些孤立的变更集之一,请忽略它.

Note that after doing this a changeset will occasionally still show up as a merge candidate - this is rather uncommon with the latest versions of TFS, and it is virtually impossible to fix (unless you are running your own local install of TFS and want to get your hands very dirty in the database). If you end up with one of these marooned changesets, just ignore it.

TFS 在合并和帮助您解决合并冲突方面做得非常出色.您唯一想以现有方式手动合并"事物的情况是,您有大量自动生成的代码(在合并时会产生大量难以解决的冲突),或者您有二进制文件.

TFS does a fantastic job of merging and helping you resolve merge conflicts. The only time you want to "merge" things manually in the way you are is when you have a lot of auto generated code (which produces a lot of hard to resolve conflicts at merge time) or you have binary files.

这篇关于在 TFS 中查找合并候选者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆