简体   繁体   English

Git将更改从祖先转移到master

[英]Git rebase changes onto master from an ancestor

So i've got the following situation where we branched for our release and continued enhancements are being added to master. 因此,在以下情况下,我们分支了我们的发行版,并将持续的增强功能添加到master中。

A---B---C---Q---W---E---R---T  master
     \         /
      D---E---F Release 1
               \
                G---H---I Release Fixes

Changes up to F of 'Release 1' are merged back into 'master'. 直到“发行版1”的F为止的更改都被合并回“主服务器”。 Is there a way to rebase/replay the 'Release Fixes' change back onto 'master'? 有没有一种方法可以将“发行修复”更改变基/重播回“主”?


Edit 编辑

To provide more information, I have done a cherry-pick of a series of commits and some of the inspected files don't seem to be at the right version. 为了提供更多信息,我对一系列提交进行了精心挑选,并且某些检查的文件似乎没有正确的版本。 If a merge is suggested, is it possible to do a merge between two commits? 如果建议合并,是否可以在两次提交之间进行合并?

Yes, the rebase command would be: 是的, rebase命令将是:

git rebase --onto master F I      #<realse1>..<release-fixes>

Not that this will remove commits G, H, and I from F and create G', H', and I' on T. If you want to leave G, H, and I in-place then you'd do: 并不是说这将从F中删除提交G,H和I,并在T上创建G',H'和I'。如果要就地保留G,H和I,则可以这样做:

git checkout master
git cherry-pick G H I    # <release1>..<release-fixes>

[edit] or, as +kirelagin points out, just do a merge to leave them in place. [edit]或+ kirelagin指出,只需合并即可将其保留在原位。

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

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