git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Subject: Re: [PATCH] rebase [--onto O] A B: omit needless checkout
Date: Wed, 19 Mar 2008 13:54:37 +0100	[thread overview]
Message-ID: <47E10D0D.2080702@viscovery.net> (raw)
In-Reply-To: <7vk5k3n2ho.fsf_-_@gitster.siamese.dyndns.org>

Junio C Hamano schrieb:
> This teaches "git rebase [--onto O] A B" to omit an unnecessary checkout
> of branch B before it goes on.
> 
> "git-rebase" originally was about rebasing the current branch to somewhere
> else, and when the extra parameter to name which branch to rebase was
> added, it defined the semantics to the safest but stupid "first switch to
> the named branch and then operate exactly the same way as if we were
> already on that branch".
> 
> But the first thing the real part of "rebase" does is to reset the work
> tree and the index to the "onto" commit.  Which means the "rebase that
> branch" form switched the work tree to the tip of the branch only to
> immediately switch again to another commit.  This was wasteful.

This works for a frequent use-case of mine:

  $ git rebase master devel

where I am already on branch master, and now want to rebase devel on top
of it.

The code seems to take care of a lot of corner cases and less frequent
use-cases, including using --onto, which I don't feel able to judge about.

> +# git reset --hard "$onto^0"

Don't forget to remove this line. ;)

-- Hannes

  parent reply	other threads:[~2008-03-19 20:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-12 19:10 optimized checkout+rebase? Ralf Wildenhues
2008-03-13  7:20 ` Johannes Sixt
2008-03-15 10:39   ` Ralf Wildenhues
2008-03-15 20:42     ` [PATCH] rebase [--onto O] A B: omit needless checkout Junio C Hamano
2008-03-15 22:21       ` Ralf Wildenhues
2008-03-16  3:56         ` Junio C Hamano
2008-03-19 12:54       ` Johannes Sixt [this message]
2008-03-19 19:19         ` Junio C Hamano
2008-03-20  7:41           ` Johannes Sixt
2008-03-20  7:53             ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47E10D0D.2080702@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=Ralf.Wildenhues@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).