Skip to contentSkip to conversation

Rebasing part of a branch

DISCUSSION Andy Parkins 2 participants 2 messages Aug 11, 2016

lore
Share & tools
lore
#0 lore raw

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

Signature · 1 line
Dr Andy Parkins, M Eng (hons), MIEE
#1 lore raw
Quoted 10 lines · Andy Parkins

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

Quoted 7 lines

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).

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git