# Re: Rebasing part of a branch

2 messages from 2006-11-02 to 2006-11-02. Participants: Jakub Narebski, Andy Parkins.
Thread: https://gitlist.dev/t/43653

## Andy Parkins, 2006-11-02 10:45

Subject: Rebasing part of a branch
Message-ID: <200611021045.25423.andyparkins@gmail.com>
URL: https://gitlist.dev/e/200611021045.25423.andyparkins%40gmail.com

```
Hello,

Is there a way to rebase part of a branch?  For example

                        H---I---J topicB
                       /
              E---F---G  topicA
             /
A---B---C---D  master

And I want:

             H---I---J  topicB
            /
            | E---F---G  topicA
            |/
A---B---C---D  master

Of course,
 
 git-checkout topicB
 git-rebase master

Doesn't work, because the common ancestor is D, which is master, and there is 
nothing to do.

Of course I can cherry-pick, but is there something like

 git-rebase --limit topicA master

Or some git-magic I can work?


Andy
-- 
Dr Andy Parkins, M Eng (hons), MIEE

```

## Jakub Narebski, 2006-11-02 11:15

Subject: Re: Rebasing part of a branch
Message-ID: <eick03$mh3$1@sea.gmane.org>
URL: https://gitlist.dev/e/eick03%24mh3%241%40sea.gmane.org
In-Reply-To: <200611021045.25423.andyparkins@gmail.com>

```
Andy Parkins wrote:

> Hello,
> 
> Is there a way to rebase part of a branch?  For example
> 
>                         H---I---J topicB
>                        /
>               E---F---G  topicA
>              /
> A---B---C---D  master
> 
> And I want:
> 
>              H---I---J  topicB
>             /
>             | E---F---G  topicA
>             |/
> A---B---C---D  master

We have
 git-rebase [--merge] [--onto <newbase>] <upstream> [<branch>]

Try then
$ git rebase --onto master topicA topicB

(if you checked out topicB, you don't need last topicB in git-rebase).
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git


```
