# Rebasing merge commits

2 messages from 2014-03-18 to 2014-03-19. Participants: Robert Dailey, Max Kirillov.
Thread: https://gitlist.dev/t/36208

## Robert Dailey, 2014-03-18 18:11

Subject: Rebasing merge commits
Message-ID: <CAHd499BFAmfDAjNr0RhCiy4vEBn2xJzCtTmwrB-U51qJryB+Dw@mail.gmail.com>
URL: https://gitlist.dev/e/CAHd499BFAmfDAjNr0RhCiy4vEBn2xJzCtTmwrB-U51qJryB%2BDw%40mail.gmail.com

```
What's the general recommendation on rebasing after creating a merge
commit on my branch? I realize rebase has the -p option but it seems
like it does a lot of complicated stuff, and it discourages
interactive rebase with the option.

My situation is simple: I have a topic1 branch that has a few commits
on it. During my work, I notice someone else implements a small bug
fix that I need. I do a `git merge --no-ff` to force that into my
branch as a separate merge commit. After that, I continue my work on
my local topic1 branch as usual. When I want latest from master, I do
`git rebase master`. However now that I have a merge commit on my
branch, things get complicated.

What's a good workflow for this, since it seems pretty common?

```

## Max Kirillov, 2014-03-19 21:00

Subject: Re: Rebasing merge commits
Message-ID: <20140319210029.GA6457@wheezy.local>
URL: https://gitlist.dev/e/20140319210029.GA6457%40wheezy.local
In-Reply-To: <CAHd499BFAmfDAjNr0RhCiy4vEBn2xJzCtTmwrB-U51qJryB+Dw@mail.gmail.com>

```
On Tue, Mar 18, 2014 at 01:11:06PM -0500, Robert Dailey wrote:
> What's the general recommendation on rebasing after
> creating a merge commit on my branch?

Basically, rebase does not do anything magic. It just
cherry-picks commits over a custom revision. You could do it
manually: reset to the master and then cherry-pick all
your commits (or whichever you would like to pick) from the
older topic1. git rebase --onto would be useful to make it
a bit less manual it there are many commits and few merges.

I used to do it myself, but later I have made my own rebase
which can somehow handle merges:
https://github.com/max630/git-rebase2/
You could try it also.

-- 
Max

```
