Subject: Re: optimized checkout+rebase?

From: Johannes Sixt <[email-masked]>
Date: Thu, 13 Mar 2008 08:20:24 +0100

Ralf Wildenhues schrieb:
> this is a common work pattern:
> 
>   git checkout master
>   git pull
>   for branch in $my_topic_branches; do
>     git checkout $branch
>     git rebase master
>     # occasional fixups here...
>   done
> 
> Now, it looks to me that one of the first operations of rebase just
> undoes part of the work that the checkout of the branch did.  Well,
> "undoes" is the wrong word, what I mean is that it looks like work
> may be saved by combining the two checkout and the rewinding step.

Well, what you could do is:

   for branch in $my_topic_branches; do
     git rebase master $branch
     # occasional fixups here...
   done

But it seems that even then rebase first does the checkout $branch, and
then the checkout master right after that. At least the first checkout
should be unnecessary because all the revision range computations and
patch formating should be possible to do without the checkout. (The second
checkout is indispensable, of course.)

This has annoyed me, too, but not so much that I started looking at a fix,
though...

-- Hannes