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

查看:74
本文介绍了在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天全站免登陆