简体   繁体   中英

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->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 :

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

How can I achieve that?

Just rebase the e branch onto the g branch:

$ git checkout e
$ git rebase g

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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