All of lore.kernel.org
 help / color / mirror / Atom feed
* Rebasing a merged branch
@ 2010-07-08 11:52 Peter Krefting
  2010-07-10  6:55 ` Chris Frey
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Krefting @ 2010-07-08 11:52 UTC (permalink / raw)
  To: Git Mailing List

Hi!

If I slightly modify the example from the git-rebase manual page to look 
like this:

   o---o---o---o  master
          \
           o---o---o---o---o  topicA
            \     /
             A---B---C---D  topicB

(topicA has merged "B" into its history; its first-parent from the line of 
"o"s).

If I now do a "git rebase --onto master topicA topicB", I only get commit C 
and D, as it sees A and B as being part of both branches.

Is there a way to make git rebase pick up A, B, C and D (and only them)?

I.e., I would like "all commits on topicB which are not in topicA's 
--first-parent history".



I eventually came up with

   git rebase --onto master $(git rev-list topicA ^topicB | tail -1) topicB

but am thinking that it ought to be expressable in a simpler way?

-- 
\\// Peter - http://www.softwolves.pp.se/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Rebasing a merged branch
  2010-07-08 11:52 Rebasing a merged branch Peter Krefting
@ 2010-07-10  6:55 ` Chris Frey
  2010-07-10  7:19   ` Peter Baumann
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Frey @ 2010-07-10  6:55 UTC (permalink / raw)
  To: Peter Krefting; +Cc: Git Mailing List

On Thu, Jul 08, 2010 at 12:52:08PM +0100, Peter Krefting wrote:
> Hi!
> 
> If I slightly modify the example from the git-rebase manual page to look 
> like this:
> 
>   o---o---o---o  master
>          \
>           o---o---o---o---o  topicA
>            \     /
>             A---B---C---D  topicB
> 
> (topicA has merged "B" into its history; its first-parent from the line of 
> "o"s).
> 
> If I now do a "git rebase --onto master topicA topicB", I only get commit C 
> and D, as it sees A and B as being part of both branches.
> 
> Is there a way to make git rebase pick up A, B, C and D (and only them)?
> 
> I.e., I would like "all commits on topicB which are not in topicA's 
> --first-parent history".


I'm no expert on rebase --onto, but aren't you trying to rebase so that
the tree looks like this afterward?


   o---o---o---o  master
            \   \
             \   A---B---C---D  topicB
              \
               o---o---o---o---o  topicA
                \     /
                 A---B
 
In which case, won't this work?

	git checkout topicB
	git rebase master

- Chris

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Rebasing a merged branch
  2010-07-10  6:55 ` Chris Frey
@ 2010-07-10  7:19   ` Peter Baumann
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Baumann @ 2010-07-10  7:19 UTC (permalink / raw)
  To: Chris Frey; +Cc: Peter Krefting, Git Mailing List

On Sat, Jul 10, 2010 at 02:55:41AM -0400, Chris Frey wrote:
> On Thu, Jul 08, 2010 at 12:52:08PM +0100, Peter Krefting wrote:
> > Hi!
> > 
> > If I slightly modify the example from the git-rebase manual page to look 
> > like this:
> > 
> >   o---o---o---o  master
> >          \
> >           o---o---o---o---o  topicA
> >            \     /
> >             A---B---C---D  topicB
> > 
> > (topicA has merged "B" into its history; its first-parent from the line of 
> > "o"s).
> > 
> > If I now do a "git rebase --onto master topicA topicB", I only get commit C 
> > and D, as it sees A and B as being part of both branches.
> > 
> > Is there a way to make git rebase pick up A, B, C and D (and only them)?
> > 
> > I.e., I would like "all commits on topicB which are not in topicA's 
> > --first-parent history".
> 
> 
> I'm no expert on rebase --onto, but aren't you trying to rebase so that
> the tree looks like this afterward?
> 
> 
>    o---o---o---o  master
>             \   \
>              \   A---B---C---D  topicB
>               \
>                o---o---o---o---o  topicA
>                 \     /
>                  A---B
>  
> In which case, won't this work?
> 
> 	git checkout topicB
> 	git rebase master
> 
> - Chris

No, this won't work. You will also rebase A^ (the o) commit in both branches
A and B.

AFAIK doing the following should do the trick:

git checkout topicB
git rebase --onto master A~1 topicB

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-07-10  7:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-08 11:52 Rebasing a merged branch Peter Krefting
2010-07-10  6:55 ` Chris Frey
2010-07-10  7:19   ` Peter Baumann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.