将Development Branch合并到Main:没有要合并的更改 [英] Merging Development Branch to Main: There were no changes to merge

查看:165
本文介绍了将Development Branch合并到Main:没有要合并的更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的主分支有一些文件,这些文件的代码与开发分支的同一文件不同。开发分支是具有这些文件的正确版本的分支,但是当我尝试将其合并到主分支(目标)时;我收到一条消息,说

My main branch has some files that have different codes from the same file of development branch. The development branch is the one that has the correct version of these files but when I am trying to merge it to main branch(target); I am getting a message saying


没有要合并的更改

There was no changes to merge

如何解决该问题,以便主分支具有这些文件的正确版本?

How can I resolve that problem so that the main branch has the correct version of those files?

推荐答案

合并文件时,TFS不仅会查看两个分支之间的差异,还会跟踪您在上一次合并尝试中是否忽略了这些更改。合并TFS时,如果有冲突,将为您提供3种选择:

When merging files TFS doesn't just look at the differences between the two branches, but it also keeps track of whether you've ignored these changes in a previous merge attempt. When merging TFS offers you 3 options when there are conflicts:


  1. 合并

  2. 保留源

  3. 保持目标

选择保持目标或手动合并并取消选择某些更改,TFS会将这些更改标记为已解决,并且将来在您尝试合并时将不再提供它们。这称为合并信用。

When you pick Keep target or when you manually merge and deselect certain changes, TFS will mark these changes as "resolved" and will not offer them again when you try to merge in the future. This is called a "merge credit".

在使用 tf merge / discard 会告诉TFS在考虑合并时忽略这些文件/变更集中的更改。

You can also create these issues using the commandline when using tf merge /discard which will tell TFS to ignore the changes in those files/changesets when considering merges.

有两种方法可以强制TFS重新考虑这些更改:

There are two ways to force TFS to reconsider these changes:


  1. 使用强制合并。在命令行上,您可以启动合并,在该合并中,TFS将暂时忽略其记录,并为您提供每个不同的文件进行合并。这可能需要做很多工作,但是一旦完成,合并历史记录就会恢复原状。要发布强制合并,请运行 tf merge $ / Source / Folder / File $ / Target / Folder / File / force 这几乎肯定会引发合并冲突,您可以解决该冲突在目标分支中获得正确的更改。

  1. Use force merge. On the commandline you can initiate a merge in which TFS will temporarily ignore it's records and will offer you every different file for merging. This can be a lot of work, but once done your merge history will be back in shape. To issue a force merge run tf merge $/Source/Folder/File $/Target/Folder/File /force This will almost certainly raise a merge conflict which you can resolve to get the right changes in the target branch.

使用回滚撤消上一个合并。如果您最近完成了合并,其中的变更集已被丢弃。在历史记录中找到它,右键单击更改集并选择 Rollback 并签入已撤消的代码。这实际上将删除该变更集中的所有变更,并将重置合并信用。完成此操作后,您可以重做合并,并在这次正确进行。也可以使用 tf rollback

Undo the previous merge using Rollback. If you've recently done the merge in which changesets have been discarded. Find it in the history, rightclick the changeset and pick Rollback and check in the code that has been undone. This will actually remove all of the changes in that changeset and will reset the "merge credits". Once this has been done you can redo the merge and do it right this time. This can also be done from the command line using tf rollback

这篇关于将Development Branch合并到Main:没有要合并的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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