是否可以禁用 Visual Studio Team System 2008 中的自动合并选项?如果是这样怎么办?
我想在将另一个开发人员处理过的文件签入 TFS 时禁用自动合并功能,以便我始终需要手动合并。有什么办法可以做到这一点吗?
I'd like to disable the automatic merge feature when checking in a file to TFS that another developer has worked on so that I always need to merge manually. Is there any way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试执行以下操作(适用于 2012 年以后的所有 Visual Studio 版本):
工具 ->选项->源代码控制 -> Visual Studio Team Foundation 服务器 ->取消选中“尝试在生成冲突时自动解决冲突”:
Try do the following (working in all Visual Studio versions from 2012-onwards):
Tools -> Options -> Source Control -> Visual Studio Team Foundation Server -> Uncheck "Attempt to automatically resolve conflicts when they are generated":
从 Visual Studio 2008 开始,简短的回答似乎是否定的。
The short answer as of Visual Studio 2008 seems to be no.
每当两个人更改了同一个文件时,您就必须“合并”代码。这可以采取三种形式:
您不能“关闭此功能”,因为没有其他安全的方法来解决该问题冲突。
关闭合并最接近的方法是禁止多次签出(锁定文件,以便一次只有一名开发人员可以处理它)。这可以防止发生两个并发编辑,从而完全避免合并问题。 (当另一个开发人员拥有锁定时,开发人员通常会被阻止并且无法处理文件,这会带来额外的成本)。这是一种糟糕且通常效率低下的工作方式 - 我不会推荐它。
您可以最大限度地减少合并的需要:
您还可以升级合并工具。 Visual Studio 的合并可怕,难以使用,并且经常会给代码带来问题。它已经咬了我很多次了,我无法相信它,所以每次都必须进行痛苦的手动合并。我现在使用 Araxis Merge,它总是完美地进行自动合并,这让我相信我可以让它为我进行合并。 (我从来没有使用过另一个给我信心的合并程序,多年来我几乎尝试了所有其他选项)。当需要手动合并时,它提供了一个非常清晰的合并视图来“阅读”,以及非常快速直观的用户界面来选择如何合并每一位代码,使其非常高效。我曾经在 VS 中为复杂的合并苦苦挣扎了 3 天(多次损坏代码直到我放弃),然后我购买了 Araxis Merge,并在 15 分钟内完美地重新完成了整个合并。一个好的工具确实可以消除合并的痛苦。
(我与 Araxis 没有任何关系,我只是无法忍受大多数糟糕的合并工具)
Whenever two people have changed the same file, you have to "merge" the code. This can take three forms:
You can't "turn this off", because there is no other safe way to resolve the clash.
The closest you can get to turning merging off is to disallow multiple checkouts (lock the file so that only one developer can work on it at a time). This prevents two concurrent edits occurring, and thus avoids the problem of merging entirely. (At the extra cost of developers often being blocked and unable to work on a file while another developer has the lock). This is an awful and usually inefficient way to work - I wouldn't recommend it.
You can minimise the need for merges:
You can also upgrade the merge tools. Visual Studio's merge is horrible, difficult to use, and often introduces problems into the code. It has bitten me so many times I cannot ever trust it, so have to do painful manual merges every time. I now use Araxis Merge which always does an automatic merge perfectly, giving me confidence that I can just leave it to do the merge for me. (I've never used another merge program that gives me that confidence, and I've tried pretty much every other option over the years). When a manual merge is required, it offers a very clear merge view to "read", and very quick and intuitive UI for choosing how to merge each bit of code, making it very efficient. I once struggled for 3 days with a complex merge in VS (corrupting the code several times until I gave up) then I bought Araxis Merge and re-did the entire merge perfectly in 15 minutes. A good tool really takes the pain out of merging.
(I am not affiliated with Araxis in any way, I just can't stand most of the terrible merge tools out there)