git merge然后是另一个git merge? [英] git merge followed by another git merge?

查看:67
本文介绍了git merge然后是另一个git merge?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个笨拙的git merge场景,在该场景中,我不确定什么是最好的前进方式.任何帮助将不胜感激.我们的开发分支有多个贡献者,因此是一个托管的git存储库.因此,共有三棵树:上游(例如upX),开发分支(例如devX)和&我的本地git树(用于开发分支)(例如local_devX)

I have an awkward git merge scenario where I am not sure what is the best way forward. Any help would be greatly appreciated. Our development branch has multiple contributors and hence is a hosted git repository. So there are three trees: upstream(say upX), development branch(say devX) & my local git tree for development branch (say local_devX)

作为开发devX的开发人员,我定期合并upX(又名上游)中的更改.最近发生了以下事情:

As a developer working on devX, I periodically merge changes from upX (aka upstream). Recently the following happened:

  1. 我合并上游更改(从upX-> local_devX)并解决所有冲突.这是树木在那点上的样子

  1. I merge upstream changes (from upX --> local_devX) and resolve all conflicts. Here is how the trees looked at that point

upX:      A---B---C---D---E---F---G
              |       |           | 
devX:         --L--M--D'--N--O    |
                                  |  
local_devX: A--B--L--M--D'--N--O--G'     

  • 我开始测试G'合并,该合并大约需要一周的时间(由于错误修复).现在与此同时,上游分支和local_devX分支都向前移动,我需要重新同步local_devX分支以适应这些更改.

  • I begin testing the G' merge which takes about a week (due to bug fixes). Now in the mean time both upstream and local_devX branches have moved forward and I need to resync local_devX branch to accommodate for those changes.

    这是我正确的地方现在:

        upX:      A---B---C---D---E---F---G---H---I
                      |       |           | 
        devX:         --L--M--D'--N--O----|--P--Q
                                          |  
        local_devX: A--B--L--M--D'--N--O--G'
    

    我总是可以删除我的local_devX分支并签出devX&的新副本.再次合并.但是,然后我将重新做我的合并提交G'.

    I can always blow away my local_devX branch and checkout a fresh copy of devX & do the merge again. But then i will be redoing my merge commit G' all over again.

    在无需重做G工作的情况下实现以下目标的最佳方法是什么?

    What would be the best way to achieve the following without having to redo G' work?

        upX:      A---B---C---D---E---F---G---H---K
                      |       |                   |
        devX:         --L--M--D'--N--O---P--Q     |
                                                  |
        local_devX: A--B--L--M--D'--N--O--P---Q---K'
    

    我想我可以再进行两个合并,一个用于devX更改(P& Q),第二个用于upX更改(H& K,因为G已经在我的本地进行了合并).但是我不确定这是否会弄乱历史记录等信息.

    I guess i can do two more merges one for devX changes(P&Q) and the second for upX changes (H&K, since G has already been merge in my local). But I am not sure if this will mess up things like having an unreadable history.

    推荐答案

    一个接一个地合并,或者连续进行多个合并都没有问题.这很普遍.这些天来,莱纳斯·托瓦尔兹(Linus Torvalds)花费了大量时间,从他十几个左右的副将中接连完成一项任务.效果很好.

    There's nothing wrong with doing one merge after another, or any number of them in a row. It's quite common. Linus Torvalds spends much time these days merging in one commit after another from his dozen or so lieutenants. It works fine.

    这篇关于git merge然后是另一个git merge?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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