git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Robert P. J. Day" <rpjday@crashcourse.ca>
Cc: Git Mailing list <git@vger.kernel.org>
Subject: Re: is "git rebase ... [branch]" equivalent to first "git checkout [branch]"?
Date: Tue, 05 Mar 2019 07:54:12 +0900	[thread overview]
Message-ID: <xmqq4l8iw8rv.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <alpine.LFD.2.21.1903041536460.12447@localhost.localdomain> (Robert P. J. Day's message of "Mon, 4 Mar 2019 15:41:16 -0500 (EST)")

"Robert P. J. Day" <rpjday@crashcourse.ca> writes:

>   i *think* i know the answer to this based on man page and reading
> the code, but i just want to verify that i'm not missing any subtlety.
> ...
>   "If <branch> is specified, git rebase will perform an automatic git
> checkout <branch> before doing anything else. Otherwise it remains on
> the current branch."

Yes, but with a caveat ;-)

At least, the original scripted version of "git rebase" both
designed and implemented the final extra "rebase this one, not the
current branch" argument as a pure short-hand for lazy people (like
me, who wanted to have such a feature and made it so) to be exact
equivalent to "checkout before doing anything else".  Which means
that HEAD@{} reflog would record such an event as "checkout that
switched to the branch", and it would have affected the computation
needed if you said "git checkout @{-1}" after the rebase finished.

I do not offhand know if the current verison of "git rebase" that
was reimplemented in C changed the behaviour, though.



      reply	other threads:[~2019-03-04 22:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-04 20:41 is "git rebase ... [branch]" equivalent to first "git checkout [branch]"? Robert P. J. Day
2019-03-04 22:54 ` Junio C Hamano [this message]

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=xmqq4l8iw8rv.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=rpjday@crashcourse.ca \
    /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).