简体   繁体   English

Mercurial工作流程 - 什么时候可以重新定义,何时合并?

[英]Mercurial workflow - when can I rebase, when should I merge?

We've been using Mercurial at work for a couple of months now. 我们已经在工作中使用Mercurial几个月了。 We've modified our workflow a few time and ended up with this: 我们已经修改了我们的工作流程一段时间,结果是:

The initital snapshot was on staging , we then cloned that onto our central repository and everyone cloned that locally . 初始快照正在进行分段 ,然后我们将其克隆到我们的中央存储库中 ,每个人都在本地克隆。

  • When we work on feature/bugfix we always update to the latest default from staging so that we start from the latest production copy. 当我们处理feature / bugfix时,我们总是从staging更新到最新的默认值,以便从最新的生产副本开始。
  • We then push the feature branch to a central repository for backup, making it available to team, etc. 然后,我们将功能分支推送到中央存储库进行备份,使其可供团队使用等。
  • We go on our QA system and pull the feature branch and merge it there. 我们继续我们的QA系统并拉出功能分支并将其合并到那里。
  • If the QA signoff on the feature, we merge it into the stable branch on the same machine. 如果QA在功能上签收,我们会将其合并到同一台机器上的稳定分支中。
  • We then pull the stable branch onto staging, merge it there and do summary testing. 然后我们将稳定分支拉到分段,将其合并到那里并进行汇总测试。
  • If all is well we robocopy everything to the live system. 如果一切顺利,我们将所有内容都复制到实时系统中。

This has worked for us for a while, but there's still rough spot that make us go: "mmmmh, maybe there's a better way, it doesn't quite feel natural" . 这对我们来说已经有一段时间了,但是仍有一些让我们走的原点“嗯,也许有更好的方式,它不太自然”

The biggest issue we have is when we have a feature branch that grows old on our local machine. 我们遇到的最大问题是我们的本地计算机上有一个功能分支。

Example: 例:

  • I have branch 62_EpicNewFeature on my system. 我的系统上有分支62_EpicNewFeature。
  • Priorities got re-organized, work on EpicNewFeature stops :( 重点组织优先事项,EpicNewFeature停止工作:(
  • 6 months after, I finally resume work on EpicNewFeature 6个月后,我终于恢复了EpicNewFeature的工作

At this point, that branch is way behind the current default. 此时,该分支远远落后于当前默认值。 If I finish it and try to merge it on QA I'll get so many conflicts (for which you pretty much always keep what's on QA now.) 如果我完成它并尝试将其合并到QA上,我将会遇到很多冲突(为此你几乎总是保留QA上的内容。)

What we sometime do to mitigate this problem is we merge default back into EpicNewFeature so as to bring it "up-to-speed". 我们有时会采取什么措施来缓解这个问题,我们将默认值合并到EpicNewFeature中,以使其“达到速度”。 This simplifies our merge on QA but it's still usually one heck of a local merge. 这简化了我们在QA上的合并,但它通常仍然是本地合并的一部分。

I've read about rebasing which is suppose to help making the next merge a fast-forward since you (from what I understand) inject the history in the middle, altering your own history. 我已经阅读了关于变基的内容,这可能有助于使下一次合并成为一个快进因为你(根据我的理解)在中间注入历史,改变你自己的历史。

Most place I've read about rebase warn you not to do it if you've already pushed your branches though, and definitely not if someone might have pulled your changes already. 我读过关于rebase的大多数地方警告你,如果你已经推动了你的分支,你就不要这样做,如果有人可能已经取消了你的修改,那绝对不会。 How can you make sure of that? 你怎么能确定这一点? we push often to the central repository for backup and we usually just hg pull everything. 我们经常推送到中央存储库进行备份,我们通常只需要提取所有内容。

Do you see something that would help us improve our current workflow? 您是否看到了有助于我们改进当前工作流程的内容? Would rebasing more often help us? 变形会更经常帮助我们吗?

I think you've misunderstood what rebasing does. 我想你误会了垫底呢。 It works by simply merging to the tip of your repository and then cutting away the original links. 它的工作原理是简单地合并到存储库的顶端,然后切掉原始链接。 It's pretty much the same action as taking a "diff" and applying that to the tip. 这与采取“差异”并将其应用于提示几乎相同。

You'll still get all the same merge conflicts you're trying to avoid. 你仍然会得到你想要避免的所有相同的合并冲突。

Usually the easiest way to deal with these conflicts is piecemeal. 通常,处理这些冲突的最简单方法是零碎的。 Don't try to to merge up to the tip all in one go. 不要试图一次性合并到提示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM