From: Junio C Hamano <gitster@pobox.com>
To: Phillip Wood <phillip.wood123@gmail.com>
Cc: Han Jiang <jhcarl0814@gmail.com>, git@vger.kernel.org
Subject: Re: `git rebase (--no-fork-point) --onto=<newbase> [<upstream> [<branch>]]` leaves HEAD detached and *HEAD not moved when <branch> is exactly `HEAD`
Date: Tue, 03 Sep 2024 08:38:29 -0700 [thread overview]
Message-ID: <xmqq4j6woih6.fsf@gitster.g> (raw)
In-Reply-To: <981c8e52-e51d-4aab-a970-bb41315e02cb@gmail.com> (Phillip Wood's message of "Mon, 2 Sep 2024 10:04:24 +0100")
Phillip Wood <phillip.wood123@gmail.com> writes:
>> I have a mild suspicion that the "rebase" command might have changed
>> its behaviour since the days back when it was implemented as a shell
>> script, when the "what to rebase" argument is HEAD, as the most
>> natural implementation to do this "optionally first switch to it
>> when the argument is given" in the scripted Porcelain is to actually
>> run "git checkout HEAD", which should be a somewhat noisy no-op.j
>
> It appears to have changed in 0cb06644a5 (rebase [--onto O] A B: omit
> needless checkout, 2008-03-15). That also changed the reflog messages
> written by "git rebase <upstream> <branch>" so that "git checkout
> @{n}" does not see the new branch being checked out.
Thanks for digging. Even if we now know that it was a regression in
the early times of the current code, it is way too old to change it
now.
Unless we want to do so at a major version bump, but I do not know
if this is big enough to worth writing a release note entry for.
Users who do want to run a trial rebase of the current branch on a
detached HEAD have all been already using HEAD^0 as the <branch>
argument and they have been fine without complaints.
Making it consistent in the opposite direction by changinging "git
checkout HEAD" to detach HEAD is unthinkable. So what we have is
fine, I would think.
Thanks.
prev parent reply other threads:[~2024-09-03 15:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-01 11:02 `git rebase (--no-fork-point) --onto=<newbase> [<upstream> [<branch>]]` leaves HEAD detached and *HEAD not moved when <branch> is exactly `HEAD` Han Jiang
2024-09-01 15:26 ` Phillip Wood
2024-09-01 15:42 ` Junio C Hamano
2024-09-01 22:05 ` Han Jiang
2024-09-02 9:04 ` Phillip Wood
2024-09-03 15:38 ` 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=xmqq4j6woih6.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=jhcarl0814@gmail.com \
--cc=phillip.wood123@gmail.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).