public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Nico Williams <nico@cryptonector.com>
To: Rodney Bates <rodney.m.bates@acm.org>
Cc: git@vger.kernel.org
Subject: Re: Contradictory git help rebase
Date: Mon, 21 Jul 2025 15:29:20 -0500	[thread overview]
Message-ID: <aH6jIGoyXc5pn8Ar@ubby> (raw)
In-Reply-To: <aafa3de8-5774-4a18-86dc-37493228b044@gmx.com>

On Mon, Jul 21, 2025 at 02:57:37PM -0500, Rodney Bates wrote:
> The text and an example in the output of git help rebase seem to contradict about
> which branch gets changed by git rebase master topic.  Here is an edited version
> of the output, with irrelevant stuff omitted and relationships made specific.
> 
> NAME
>        git-rebase - Reapply commits on top of another base tip
> 
> SYNOPSIS
>        git rebase
>                                                 [<upstream> [<branch>]]
> 
> In the example command below, <upstream> is master and <branch> is topic.
> 
> 
>        If <branch> is specified, git rebase will perform an automatic git switch <branch> before doing anything else.
>        Otherwise it remains on the current branch.
> 
> Current branch is now <branch>=topic.
> 
>        If <upstream> is not specified ... (irrelevant)
> 
> 
>        All changes made by commits in the current branch (=topic) but that are not in <=upstream> (master) are saved to a temporary area.
> 
>        The current branch is reset to <upstream>,
> 
> Current branch is now <upstream>=master.

No, that's not correct.  "The current branch is reset to <upstream>"
means that the current branch's head commit is reset to the same as
<upstream>'s.  That's what resetting a branch means: it means changing
the commit that the branch points to.

You misinterpreted "[t]he current branch is reset to <upstream>" to mean
"the current workspace's branch is changed to be <upstream>", but this
is wrong.

"Reset" is confusing, so it's no surprise that it confused you.

>        The commits that were previously saved into the temporary area are then reapplied to the current branch (master), one by
>        one, in order.
> 
> I.e., master is changed, topic is not.
>
> [...]
>
> But this diagram shows topic changed, master not.

No, because you misunderstood what reset means.

Nico
-- 

      reply	other threads:[~2025-07-21 20:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-21 19:57 Contradictory git help rebase Rodney Bates
2025-07-21 20:29 ` Nico Williams [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=aH6jIGoyXc5pn8Ar@ubby \
    --to=nico@cryptonector.com \
    --cc=git@vger.kernel.org \
    --cc=rodney.m.bates@acm.org \
    /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