Git development
 help / color / mirror / Atom feed
* How to rebase after upstream was merged?
@ 2007-07-04 12:24 Johannes Sixt
  2007-07-04 13:30 ` Johannes Schindelin
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Sixt @ 2007-07-04 12:24 UTC (permalink / raw)
  To: git

I have this history:

o--o--o--o--o   <- origin
    \        \
     x--x--x--M--x--x  <- master (HEAD)

At this point I would like to rebase to straighten the history, but it
won't let me:

    $ git rebase origin
    Current branch master is up to date.

However, if there were additional commits on origin, it would work as
expected, i.e. all the 'x', but not 'M',  would be moved on top of
origin. The reason is that rebase checks whether the merge base of
origin and HEAD is origin, and exits early if it is.

I would like to extend the check to also check for linear history. How
can I do this most efficiently? My first try is along these lines:

  test $(git rev-list origin..HEAD | wc -l) = \
       $(git rev-list --no-merges origin..HEAD | wc -l)

Is there a better approach?

-- Hannes

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

* Re: How to rebase after upstream was merged?
  2007-07-04 12:24 How to rebase after upstream was merged? Johannes Sixt
@ 2007-07-04 13:30 ` Johannes Schindelin
  2007-07-04 13:45   ` Johannes Sixt
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Schindelin @ 2007-07-04 13:30 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git

Hi,

On Wed, 4 Jul 2007, Johannes Sixt wrote:

> I have this history:
> 
> o--o--o--o--o   <- origin
>     \        \
>      x--x--x--M--x--x  <- master (HEAD)
> 
> At this point I would like to rebase to straighten the history, but it
> won't let me:
> 
>     $ git rebase origin
>     Current branch master is up to date.

I'd do something like

$ git checkout -b tmp HEAD~3
$ git rebase origin
$ git checkout master
$ git rebase --onto tmp HEAD~2
$ git branch -d tmp

> I would like to extend the check to also check for linear history. How
> can I do this most efficiently? My first try is along these lines:
> 
>   test $(git rev-list origin..HEAD | wc -l) = \
>        $(git rev-list --no-merges origin..HEAD | wc -l)
> 
> Is there a better approach?

I usually to

	test -z "$(git rev-list --parents origin..HEAD | grep " .* ")"

Hth,
Dscho

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

* Re: How to rebase after upstream was merged?
  2007-07-04 13:30 ` Johannes Schindelin
@ 2007-07-04 13:45   ` Johannes Sixt
  0 siblings, 0 replies; 3+ messages in thread
From: Johannes Sixt @ 2007-07-04 13:45 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

Johannes Schindelin wrote:
> [...how to check for linear history...]
> I usually to
> 
>         test -z "$(git rev-list --parents origin..HEAD | grep " .* ")"

Ah, that's much better.

Thanks,
-- Hannes

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

end of thread, other threads:[~2007-07-04 13:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-04 12:24 How to rebase after upstream was merged? Johannes Sixt
2007-07-04 13:30 ` Johannes Schindelin
2007-07-04 13:45   ` Johannes Sixt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox