简体   繁体   English

git rebase或合并某个提交到其他两个提交之间的提交

[英]git rebase or merge a certain commit to be beween two other commits

I have a master branch, with commits: 我有一个主分支,有提交:

a->b->c->d->e

At a certain point I checked out a branch called fix from commit c 在某个时刻,我从提交c签出了一个名为fix的分支

c->f->g

So the big picture is like this: 因此,总体情况如下:

a->b->c->d->e
     \
      \->f->g

I would like to perform the merge so that in the linear tree f and g are between c and d : 我想执行合并,以便在线性树中fgcd之间:

a->b->c->f->g->d->e

How can I achieve that? 我该如何实现?

Just rebase the e branch onto the g branch: 只需将e分支重新设置到g分支即可:

$ git checkout e
$ git rebase g

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

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