将多个 Mercurial 分支合并在一起

发布于 2024-11-03 17:10:23 字数 79 浏览 1 评论 0原文

我有一群开发人员使用分支修复错误。我的需要:自动(或者有没有办法)将所有这些分支合并到一个主分支“默认”的最佳方法是什么。

谢谢

I have a bunch of developers who do their bug fixes using branches. My Need: What's the best way to automate (or is there a way) merging all of these branches into one main branch, "default".

Thanks

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

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

发布评论

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

评论(1

老娘不死你永远是小三 2024-11-10 17:10:23

注意:这是我的意见,这里可能有多种意见,但至少要理解我的观点并决定你想要不同的观点。

首先,这里缺少一些东西,我认为从长远来看这会给你带来工作流程问题。

合并不应该被跳过或委托给其他人,在这些分支中工作的开发人员应该自行合并。他们,可能只有他们,会知道他们做了什么,以及如何解决合并冲突。

无论如何,完全自动化地完成它是行不通的。

这是开发人员应该使用的工作流程(在我看来)。

定期(例如每天早上),分支上的开发人员应该检查构建服务器以确保默认分支构建。如果确实如此(而且应该如此!),他们会将默认分支合并到自己的分支中。

这具有三个主要好处:

  1. 他们总是在自己的分支中拥有最新的代码,并且不会陷入另一个分支中已修复的已知错误的工作中
  2. 他们不断地处理来自其他分支的合并冲突,而这些冲突是很小,而且这些变化对于做出这些变化的开发人员来说仍然记忆犹新。
  3. 由于您每天都会处理合并冲突(假设存在任何冲突),因此当您到达该分支的生命周期时,它几乎已与默认分支完全合并,因此将其合并回默认分支所涉及的工作现在即使不是免费,也应该很便宜。

在某些时候,他们被读取将他们的工作集成回默认分支(或者定期,即新功能的部分发布,或者在最后,一切都完成),然后他们再次合并来自< /em> 默认回到自己的分支。这确保了任何挥之不去的合并冲突都由该团队在其分支中处理,然后再将其发布给其他开发人员。

当他们处理了由于该合并而导致的任何合并冲突时,他们可以合并另一个方向,从其分支返回到默认分支。此时,除非有人设法同时将任何冲突的更改合并/推送为默认值,否则根本不会出现合并冲突。

这样做可以确保:

  1. 进行合并的开发人员接受合并方面的培训 进行
  2. 更改的开发人员仍然对这些更改记忆犹新
  3. 您可以通过经常进行合并冲突并分小部分进行来分摊与合并冲突相关的工作。
  4. 你不会在项目结束时进行一次大的合并——“一周”,此时每个人都忘记了所有的更改,为什么完成这些更改以及是谁做的

如果其中任何一个不清楚,请发表评论,我会相应地更新/编辑。

Note: This is my opinion, there can be multiple opinions here, but at least understand my point here and decide you want it different.

First of all, there is something missing here, and I think this will generate workflow problems for you in the long run.

Merging is not something that should be skipped, or delegated to other people, the developers that work in those branches should merge themselves. They, and probably only they, will know what they did, and how to resolve merge conflicts.

In any way, doing it fully automatic, that's not going to work.

Here's the workflow the developers should use (in my opinion.)

Periodically, for instance every morning, the developers on a branch should check the build server to ensure that the default branch builds. If it does (and it should!), they merge from the default branch down into their own.

This has three major benefits:

  1. They always have the latest code in their own branch, and don't get bogged down working around known bugs that have already been fixed in another branch
  2. They deal with merge conflicts from other branches constantly, while the conflicts are small, and the changes are still fresh in the minds of the developers that did them.
  3. Since you deal with the merge conflicts every day (provided there are any), when you get to the end of the life of that branch, it is almost fully merged with the default branch anyway, so the work involved in merging it back into default should now be cheap, if not free.

At some point they're read to integrate their work back into the default branch (either periodically, ie. partial releases of new features, or at the end, everything is done), and then they do yet another merge from default back into their own branch. This ensures that any lingering merge conflicts are handled by that team, in their branch, before they release it to the rest of the developers.

When they have dealt with any merge conflicts due to that merge, they can merge the other direction, from their branch back to default. At this point, unless someone has managed to merge/push any conflicting changes into default in the meantime, there will be no merge conflicts at all.

Doing it this way ensures that:

  1. The developers who do the merges get training in merging
  2. The developers who did the changes still have those changes fresh in memory
  3. You amortize the work involved with merge conflicts by doing them often, and doing them in small portions.
  4. You don't get a big merge-"week" at the end of a project, when everyone has forgotten all the changes, why they were done and who did them

If any of this was unclear, please leave a comment and I'll update/edit accordingly.

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