是否可以禁用 Visual Studio Team System 2008 中的自动合并选项?如果是这样怎么办?

发布于 2024-08-09 22:38:53 字数 67 浏览 9 评论 0原文

我想在将另一个开发人员处理过的文件签入 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

再见回来 2024-08-16 22:38:53

尝试执行以下操作(适用于 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":

enter image description here

不打扰别人 2024-08-16 22:38:53

从 Visual Studio 2008 开始,简短的回答似乎是否定的。

The short answer as of Visual Studio 2008 seems to be no.

烟花肆意 2024-08-16 22:38:53

每当两个人更改了同一个文件时,您就必须“合并”代码。这可以采取三种形式:

  • 保留您的版本(放弃他们的更改)
  • 保留他们的版本(放弃您的更改)
  • 合并两个更改以将它们混合在一起

您不能“关闭此功能”,因为没有其他安全的方法来解决该问题冲突。

关闭合并最接近的方法是禁止多次签出(锁定文件,以便一次只有一名开发人员可以处理它)。这可以防止发生两个并发编辑,从而完全避免合并问题。 (当另一个开发人员拥有锁定时,开发人员通常会被阻止并且无法处理文件,这会带来额外的成本)。这是一种糟糕且通常效率低下的工作方式 - 我不会推荐它。

您可以最大限度地减少合并的需要:

  • 经常签入。许多小的更改会减少合并冲突的风险,而一些大的更改会增加您的风险。
  • 将大型且经常更改的文件拆分为许多较小的文件,以最大程度地减少 2 个开发人员需要同时更改同一文件的机会
  • 在开始处理文件之前,请检查是否有其他人正在编辑该文件,并尝试重新组织您的文件“计划”,这样您就不必在其他程序员正在处理该文件时开始编辑该文件(自我强加的“软锁”,以减少需要合并的机会)

您还可以升级合并工具。 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:

  • Keep your version (discarding their changes)
  • Keep their version (discarding your changes)
  • Merge both changes to blend them both together

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:

  • Check in frequently. Many small changes reduces your exposure to merge conflicts, while a few large changes increase your exposure.
  • Split large and often-changed files up into many smaller files to minimise the chance that 2 developers need to chnage the same file at the same time
  • Before you start working on a file, check if anyone else is editing it, and try to reorganise your "schedule" so that you don't have to start editing that file while the other programmer is working on it (a self-imposed "soft lock", to just reduce the chance of merges being necessary)

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)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文