在版本控制中分支可能会遇到哪些问题?

发布于 2024-09-08 22:13:14 字数 478 浏览 3 评论 0 原文

您能否推荐一篇文章、一本书或一篇会议论文,介绍软件团队在版本控制环境中分支时可能遇到的问题?我们正在为我们的一位赞助商创建一份摘要,并且需要引用可靠的信息来源。到目前为止,我已经找到 Chris Birmele埃里克·辛克

提前致谢!

附: Appleton 等人的文章并行软件开发的分支模式。 al 看起来很基础,但相当古老。

Could you please suggest an article, a book, or a conference paper about possible problems a software team may experience with branching in version control environment? We're creating a summary for one of our sponsors, and need to quote respectable sources of information. So far I've found short reviews by Chris Birmele and Eric Sink.

Thanks in advance!

ps. The article Branching Patterns for Parallel Software Development by Appleton et. al looks fundamental, but rather old.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

说谎友 2024-09-15 22:13:14

正如 Martin Fowler 的 Bliki 中提到的,FeatureBranch 可能存在语义冲突

替代文本

我更担心的问题是语义冲突。
一个简单的例子是,如果 Plum 教授更改了 Green 牧师的代码调用的方法的名称。
重构工具允许您安全地重命名方法,但仅限于您的代码库。因此,如果 G1-6 包含调用 foo 的新代码,Plum 教授无法在他的代码库中得知,因为他没有它。你只能在大合并中找到答案。

函数重命名是一个相对明显的语义冲突案例。实际上,它们可以更加微妙。测试是发现它们的关键,但是要合并的代码越多,发生冲突的可能性就越大,修复它们也就越困难。
冲突的风险,尤其是语义冲突,让大型合并变得可怕。

请参阅 这个问题


考虑到这一点后,您还需要区分 CVCS 和 DVCS(集中式 VCS 与分布式 VCS),因为 DVCS 将为分支带来正交维度:“发布”(向/从远程存储库推送/拉取,这意味着您可以在“同一”分支上工作,同时仍然完全隔离,因为您正在处理本地克隆存储库)。
像 SVN 这样的 CVCS 有其自己的问题 ://stackoverflow.com/questions/2471606/how-and-or-why-is-merging-in-git-better-than-in-svn/2472251#2472251">合并分支,DVCS是应该是非常擅长的。

另请参阅“何时应该分支?

As mention in Martin Fowler's Bliki, FeatureBranch can have their issue with semantic conflicts.

alt text

The problem I worry more about is a semantic conflict.
A simple example of this is that if Professor Plum changes the name of a method that Reverend Green's code calls.
Refactoring tools allow you to rename a method safely, but only on your code base. So if G1-6 contain new code that calls foo, Professor Plum can't tell in his code base as he doesn't have it. You only find out on the big merge.

A function rename is a relatively obvious case of a semantic conflict. In practice they can be much more subtle. Tests are the key to discovering them, but the more code there is to merge the more likely you'll have conflicts and the harder it is to fix them.
It's the risk of conflicts, particularly semantic conflicts, that make big merges scary.

See example of semantic conflicts in this SO question.


Once that is taken into account, you need also to differentiate CVCS and DVCS (Centralized vs. Distributed VCS), as a DVCS will bring an orthogonal dimension to branching: "publication" (push/pull to/from remote repositories, meaning you can work on the "same" branch, while still being in complete isolation because you are working on a local cloned repository).
CVCS like SVN have their own issues with merging branches, which DVCS are supposed to be very good at.

See also "When should you branch?"

我三岁 2024-09-15 22:13:14

查看 Hg Init - 它详细解释了为什么分支在某些情况下会出现很大问题以及如何缓解此问题。关键是分支根本不是问题,但是合并不同分支上的更改可能会消耗大量时间。

Look at Hg Init - it explains in detail why branching is very problematic in certain cases and how to mitigate this problem. The key point is that branching is not a problem at all, but merging back changes on different braches can consume a lot of time.

沧笙踏歌 2024-09-15 22:13:14

很抱歉,我找不到对实际声明的引用,但我记得 Larry McVoy 说了一些话“你永远不希望分支倍增,你总是想再次将分支合并在一起”。分支的突出时间越长,其中一个分支的更改与另一个分支的更改发生冲突的可能性就越大。功能分支是你的朋友,但我确实建议经常拉动更改,以跟上“主干”或“上游”的道德等价物的变化,并确保尽快将分支合并回“主干”或“上游”他们的需要得到满足。

也许更简洁地说,我总是发现在创建分支之前定义分支的生命周期很有用。知道你为什么要创建一个分支,它会存在多久,什么时候你会决定合并它或扔掉它。

I'm sorry I cannot find a reference to the actual statement, but I recall Larry McVoy saying something along the lines of "you never want branches to multiply, you always want to merge branches back together again". The longer your branches are outstanding, the more likely it is for changes in one to conflict with changes in another. Feature branches are your friends, but I do recommend pulling changes often enough to keep abreast of changes in the moral equivalent of 'trunk' or 'upstream', and be sure to merge branches back into 'trunk' or 'upstream' as soon as their need is fulfilled.

Perhaps more succinctly, I've always found it useful to define the lifetime of a branch before creating it. Know why you're creating a branch, how long it will survive, when you'll decide to merge it or throw it away.

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