为什么 TFS 允许单个变更集影响多个分支?如果没有很好的理由,是否可以防止这种情况发生? [英] Why does TFS allow a single changeset to affect multiple branches? If there isn't a very good reason, can this be prevented?

查看:32
本文介绍了为什么 TFS 允许单个变更集影响多个分支?如果没有很好的理由,是否可以防止这种情况发生?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近发生的事情是,一位同事在对我们的解决方案的稳定分支进行了一些小的更改后,不小心将他的一些未完成的工作也签入了开发分支.TFS 将其全部捆绑为一个变更集.

It has recently happened that a coworker, after completing some minor changes to the Stable branch of our solution, accidentally checked-in some of his unfinished work on the Development branch as well. TFS bundled it all up as a single changeset.

虽然这个错误很容易被发现和修复,但我觉得我在这里遗漏了一些关键的东西.为什么 TFS 的待定更改"页面允许您(更糟糕的是,默认情况下提供)创建一个包含您在每个分支上所做的一切的单一变更集?

While the mistake was easily detected and fixed, I feel like I am missing something critical here. Why would TFS's "Pending changes" page allow you (and, worse, offer by default) to create a single changeset containing everything you've done on every branch?

在我看来,变更集应该包含对一个和只有一个分支的更改,因此您可以根据需要更有效地管理/合并/回滚它们,而不会影响其他分支.如果您同时在多个分支上工作,则在签入时它应该要求您插入多个描述,并因此创建多个变更集.

It seems to me that a changeset should consist of changes to one and only one branch, so you can more effectively manage/merge/rollback them as necessary, without affecting other branches. If you have been working on multiple branches at the same time, upon checking-in it should ask you to insert multiple descriptions, and create multiple changesets as a result.

假设我的推理至少是有效的(如果不一定是通用的),是否有一种方法可以配置 TFS,以便用户一次不会签入对多个分支的更改?

Assuming my reasoning is at least valid (if not necessarily universal), is there a way to configure TFS so that users may not check-in changes to more than one branch at a time?

如果失败,我希望有一种方法至少设置待更改"页面以将所有更改的文件默认放在已排除"部分,因此用户需要在签入之前手动包含它们(这会帮助他们注意到任何意外变化).

Failing that, I would appreciate a way to at least set the 'Pending Changes' page to put all changed files by default in the 'Excluded' section, so users will need to manually include them before checking in (which would help them notice any accidental changes).

推荐答案

最佳实践: 开发人员可以通过右键单击给定文件夹/分支,选择签入挂起的更改".对于该签入操作,待定更改"视图将暂时排除"在该文件夹/分支之外所做的任何更改,直到您完成签入.

Best practice: A developer can check in pending changes limited to a given folder/branch by right-clicking the folder, choosing "Check in pending changes". For that check-in action, the "Pending Changes" view will temporarily "exclude" any changes made outside of that folder/branch until you complete the check-in.

是否可以阻止:根据 Microsoft,有一个预制的签入策略选项,称为强制签入以仅包含属于当前解决方案的一部分的文件".假设您使用解决方案",这可能对您有用.

Can it be prevented: Per Microsoft, there is a premade Check-in Policy option known as "Enforce check-in to only contain files that are part of current solution". This may work for you, assuming you use "Solutions".

为什么允许这样做:我想这就是 TFS 的设计方式.我怀疑这与将分支视为文件夹有关,并允许跨文件夹签入泄漏到允许跨分支签入.

Why is this allowed: I suppose it's just how TFS was designed. I'd suspect it's to do with the treatment of branches as folders, and allowing check-in's across folders leaks into allowing check-in's across branches.

这篇关于为什么 TFS 允许单个变更集影响多个分支?如果没有很好的理由,是否可以防止这种情况发生?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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