在签入 TFS 之前是否必须执行获取最新信息,以免覆盖/丢失代码? [英] Is performing a Get Latest mandatory before checking in in TFS so you do not overwrite/lose code?

查看:32
本文介绍了在签入 TFS 之前是否必须执行获取最新信息,以免覆盖/丢失代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的团队中有一个反复出现的问题让我发疯.人们声称 Team Foundation Server 中的某些签入会覆盖以前的签入/现有代码.他们声称您总是需要在签入之前执行获取最新版本.换句话说,运行 get latest 是正确签入的先决条件.

There is a recurring issue in my team that is driving me nuts. People claim that some check-ins in Team Foundation Server are overwriting previous check-ins/existent code. They claim you always need to do a Get Latest Version before doing a check-in. In other words, running a get latest is a pre-requisite for a proper check-in.

作为回应,我回复如下:如果上述情况确实发生,则必须有一个 TFS 定义/设置我们缺少/我们未选中.拥有一个不会在签入时自动警告您代码冲突的版本控制系统有什么意义(如果在您签入之前有人签入了与您不同的代码)?我会理解是否存在设置这种或那种行为的设置(无论现在数据库中有什么,请检查或警告是否存在冲突并提示采取行动(合并)).

I, in response, reply as follows: There must be a TFS definition/setting that we are missing/we left unchecked, if the described above is really happening. What would be the point in having a Version Control system that will not automatically warn you about code conflicts upon checking in (if before your check in someone else checked in different code than yours) ? I would understand if there were settings that set this or that behavior (check in regardless of what is there in the db now or warn if there are conflicts and prompt for action (merge)).

我想明白:我错了吗?!这只是 TFS 的工作方式吗?获取最新在任何签入之前都是强制性的,无论如何?!

I want to understand: am I wrong ?! Is this simply the way TFS works ? Get Latest is mandatory before any check ins, no matter what ?!

顺便说一句,如果不手动运行 get latest 进行检查是有风险的,为什么微软不把它作为默认行为?!

As a side note, if checking in without manually running a get latest is risky and dangerous, why would Microsoft not make this the default behavior ?!

提前致谢!

推荐答案

我认为获取最新版本是一种很好的做法,但不是强制性的.

I'd say doing a get latest is good practice, but not mandatory.

如果我有一个我一直在修改的文件,并且服务器上保存了一个更新的版本.

If I have a file that I've been modifying, and there is a more recent version held on the server.

  • 如果我获取最新信息,我希望会检测到冲突,并且会要求我在本地文件系统被覆盖之前解决冲突
  • 如果我尝试签入文件而不执行获取最新信息,我希望 TFS 再次检测到冲突并要求我解决它.

我刚刚测试了这种行为,这就是我所看到的.我在本地工作区中使用 TFS 2013 和 VS 2013.我确信服务器工作区的行为方式相同.

I've just tested this behaviour and this is what I see. I'm using TFS 2013 and VS 2013 with local workspaces. I'm certain that server workspaces behave in the same way.

我可以看到的两种不遵循这种模式的场景是

The 2 scenarios that I can see that wouldn't follow this pattern are

  1. 更改位于文件的不同部分,因此 TFS 会尝试自动解决冲突.我希望这相当安全,您会看到两组更改.
  2. 签入文件第二个版本的人误解了冲突解决屏幕,并在看到解决选项时选择了保留本地版本".

我会说获取最新版本更安全,因为您可以在解决冲突后构建代码,以确保在不破坏构建的情况下解决了它,但是如果您有一个强大的 CI 流程,那么这降低了一些风险.

I would say that it's safer to do the get latest, as you can build the code after resolving the conflict to make sure that you've resolved it without breaking the build, however if you have a strong CI process in place then this reduces some of the risk.

是获取最新状态的文档

请记住,如果您获得文件的旧版本,对其进行更改,然后尝试将其签入,则在完成签入之前需要解决冲突的可能性会增加.

Keep in mind that if you get an older version of a file, make changes to it, and then try to check it in, there is an increased chance that you will need to resolve conflicts before you can complete the check-in.

这个有关签入的文档,在讨论尝试签入更改的结果时包含以下内容

And this is the documentation on check in, which contains the following when discussing the outcomes of trying to check in a change

冲突会阻止您签入.系统会向您显示您对服务器上文件的最新版本所做的更改之间的冲突..

Conflicts block your check in. The system presents you with conflicts between your changes the latest version of the files on the server. .

第二次您可能会在 这个问题很有趣.有关信息 Edward Thompson 在搬到 github 之前是 TFS 团队的一名开发人员

Second You might find the comments on this question interesting. For Info Edward Thompson was a developer on the TFS team before he moved to github

Automerge 在所有供应商中大体相同,并且没有任何长期存在的已知问题.也就是说,关闭它可能会有所帮助(工具 -> 选项 -> 源代码管理 -> Visual Studio Team Foundation Server -> 尝试在生成冲突时自动解决冲突)

Automerge is generally the same across all vendors, and there aren't any longstanding known issues there. That said, it may be helpful to turn it off (Tools -> Options -> Source Control -> Visual Studio Team Foundation Server -> Attempt to automatically resolve conflicts when they are generated)

这篇关于在签入 TFS 之前是否必须执行获取最新信息,以免覆盖/丢失代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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