From: Junio C Hamano <gitster@pobox.com>
To: "Julia Evans via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Julia Evans <julia@jvns.ca>
Subject: Re: [PATCH v2 5/5] doc: git-rebase: update discussion of internals
Date: Fri, 08 Aug 2025 14:54:13 -0700 [thread overview]
Message-ID: <xmqqbjopfpiy.fsf@gitster.g> (raw)
In-Reply-To: <ad97cd9e6718be2540657c2c820f29b9efafa883.1754680525.git.gitgitgadget@gmail.com> (Julia Evans via GitGitGadget's message of "Fri, 08 Aug 2025 19:15:25 +0000")
"Julia Evans via GitGitGadget" <gitgitgadget@gmail.com> writes:
> From: Julia Evans <julia@jvns.ca>
>
> - make it clearer that we're talking about three steps of a process
A good call. "First, then, then" does make it clear where each new
step begins. "First, then, finally" would make it even more obvious
which step concludes the sequence, though.
> - delete a duplicate explanation of how git rebase skips commits with
> the same textual changes (it's explained in more detail a few lines
> further down)
OK.
> - move the `ORIG_HEAD` note down so that it doesn't interrupt the
> discussion of the mechanics.
I thought you moved the "finally we reapply" up, instead of moving
the note down ;-) And when viewed that way, a more direct way to
justify this change is that you made sure these three steps are kept
together.
Again, good change.
> -All changes made by commits in the current branch but that are not
> +Here is a more detailed description of what `git rebase <upstream>` does:
> +
> +First, all changes made by commits in the current branch but that are not
> in `<upstream>` are saved to a temporary area. This is the same set
> of commits that would be shown by `git log <upstream>..HEAD`; or by
> `git log 'fork_point'..HEAD`, if `--fork-point` is active (see the
> description on `--fork-point` below); or by `git log HEAD`, if the
> `--root` option is specified.
If we are ambitious, we may want to rewrite this first step to put
almost no stress on "saving" and "temporary area". Especially when
you rebase with merge backend, it would be morally a sequence of
cherry-pick, without us having to save anything---we only need to
figure out which commits to replay in what order.
First, the command figures out changes from which commits to
replay in what order. The set of commits are those shown by
`git log <base>..HEAD`, where <base> is the <upstream> if given,
or computed fork-point if the `--fork-point` option is active,
or all commits that lead to `HEAD` if `--root` is given.
> -The current branch is reset to `<upstream>` or `<newbase>` if the
> +Then the current branch is reset to `<upstream>` or `<newbase>` if the
> `--onto` option was supplied. This has the exact same effect as
> `git reset --hard <upstream>` (or `<newbase>`). `ORIG_HEAD` is set
> to point at the tip of the branch before the reset.
"This has the exact same effect as" made my reading hiccup.
Then `git reset --hard` rewinds the current branch to the commit
given by `--onto`, if specified, or to `<upstream>`.
I am not sure if it is worth talking about ORIG_HEAD at this point,
as that is part of what `git reset --hard` does with this step.
Given especially that we have NOTE that says ORIG_HEAD cannot be
relied upon once the replaying of commits begin, mentioning the
value of ORIG_HEAD before the replaying begins does not seem to add
much value to the explanation.
> +Then the commits that were previously saved into the temporary area are
> +reapplied to the current branch, one by one, in order.
Yup. As I suggested, "Then" -> "Finally".
I do not know how much detail we want to give to readers, and I do
to prefer to tell some white lie in end-user facing documentation if
simplified description helps the initial understanding, so I am not
yet decided if I recommend rewriting these "three step" explanation,
but FYI, the modern rebase machinery works slightly differently:
First the command figures out what to replay, on which commit,
and in what order.
Then the HEAD is detached ("git checkout --detach <onto>") to
the commit the first change is replayed onto.
Then the changes are replayed, one by one, in the order.
Optionally a mergy history can be rebased while retaining
the topology.
Finally, the branch being rebased is made to point at the
resulting HEAD (i.e. equivalent to "git checkout -B <branch>"
to jump back from the detached HEAD state).
The difference between the simplified procedure and this "replaying
is done while on detached HEAD" procedure gives us a somewhat big
usability improvement, as a rebasing will be recorded in a single
reflog event for the branch getting rebased, no matter how many
commits are on the branch.
next prev parent reply other threads:[~2025-08-08 21:54 UTC|newest]
Thread overview: 103+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-08 15:24 [PATCH 0/5] doc: git-rebase: clarify DESCRIPTION section Julia Evans via GitGitGadget
2025-08-08 15:24 ` [PATCH 1/5] doc: git-rebase: start with an example Julia Evans via GitGitGadget
2025-08-08 16:30 ` Junio C Hamano
2025-08-08 17:13 ` Julia Evans
2025-08-08 18:11 ` Junio C Hamano
2025-08-08 15:24 ` [PATCH 2/5] doc: git rebase: dedup merge conflict discussion Julia Evans via GitGitGadget
2025-08-08 17:48 ` Junio C Hamano
2025-08-08 15:24 ` [PATCH 3/5] doc: git rebase: clarify arguments syntax Julia Evans via GitGitGadget
2025-08-08 15:24 ` [PATCH 4/5] doc: git-rebase: move --onto explanation down Julia Evans via GitGitGadget
2025-08-08 15:24 ` [PATCH 5/5] doc: git-rebase: update discussion of internals Julia Evans via GitGitGadget
2025-08-08 19:15 ` [PATCH v2 0/5] doc: git-rebase: clarify DESCRIPTION section Julia Evans via GitGitGadget
2025-08-08 19:15 ` [PATCH v2 1/5] doc: git-rebase: start with an example Julia Evans via GitGitGadget
2025-08-08 23:31 ` Junio C Hamano
2025-08-08 19:15 ` [PATCH v2 2/5] doc: git rebase: dedup merge conflict discussion Julia Evans via GitGitGadget
2025-08-08 19:15 ` [PATCH v2 3/5] doc: git rebase: clarify arguments syntax Julia Evans via GitGitGadget
2025-08-08 21:09 ` Junio C Hamano
2025-08-08 19:15 ` [PATCH v2 4/5] doc: git-rebase: move --onto explanation down Julia Evans via GitGitGadget
2025-08-08 19:15 ` [PATCH v2 5/5] doc: git-rebase: update discussion of internals Julia Evans via GitGitGadget
2025-08-08 21:54 ` Junio C Hamano [this message]
2025-08-08 22:52 ` [PATCH v3 0/5] doc: git-rebase: clarify DESCRIPTION section Julia Evans via GitGitGadget
2025-08-08 22:52 ` [PATCH v3 1/5] doc: git-rebase: start with an example Julia Evans via GitGitGadget
2025-08-08 22:52 ` [PATCH v3 2/5] doc: git rebase: dedup merge conflict discussion Julia Evans via GitGitGadget
2025-08-08 22:52 ` [PATCH v3 3/5] doc: git rebase: clarify arguments syntax Julia Evans via GitGitGadget
2025-08-08 22:52 ` [PATCH v3 4/5] doc: git-rebase: move --onto explanation down Julia Evans via GitGitGadget
2025-08-08 22:52 ` [PATCH v3 5/5] doc: git-rebase: update discussion of internals Julia Evans via GitGitGadget
2025-08-09 1:14 ` [PATCH v4 0/5] doc: git-rebase: clarify DESCRIPTION section Julia Evans via GitGitGadget
2025-08-09 1:14 ` [PATCH v4 1/5] doc: git-rebase: start with an example Julia Evans via GitGitGadget
2025-08-10 15:41 ` Phillip Wood
2025-08-11 8:46 ` Patrick Steinhardt
2025-08-11 9:13 ` Karthik Nayak
2025-08-11 12:27 ` Ben Knoble
2025-08-12 9:05 ` Karthik Nayak
2025-08-12 14:30 ` Junio C Hamano
2025-08-11 13:07 ` Phillip Wood
2025-08-12 9:07 ` Karthik Nayak
2025-08-12 17:07 ` D. Ben Knoble
2025-08-12 18:07 ` Junio C Hamano
2025-08-14 7:23 ` Karthik Nayak
2025-08-09 1:14 ` [PATCH v4 2/5] doc: git rebase: dedup merge conflict discussion Julia Evans via GitGitGadget
2025-08-11 8:46 ` Patrick Steinhardt
2025-08-11 13:02 ` Phillip Wood
2025-08-09 1:14 ` [PATCH v4 3/5] doc: git rebase: clarify arguments syntax Julia Evans via GitGitGadget
2025-08-09 1:14 ` [PATCH v4 4/5] doc: git-rebase: move --onto explanation down Julia Evans via GitGitGadget
2025-08-09 14:55 ` D. Ben Knoble
2025-08-09 1:14 ` [PATCH v4 5/5] doc: git-rebase: update discussion of internals Julia Evans via GitGitGadget
2025-08-10 15:42 ` Phillip Wood
2025-08-13 18:55 ` symmetric difference with --left-only vs. range notation D. Ben Knoble
2025-08-13 21:40 ` Junio C Hamano
2025-08-11 8:46 ` [PATCH v4 5/5] doc: git-rebase: update discussion of internals Patrick Steinhardt
2025-08-11 12:29 ` Ben Knoble
2025-08-11 13:45 ` Patrick Steinhardt
2025-08-11 19:34 ` Julia Evans
2025-08-11 20:12 ` [PATCH v5 0/5] doc: git-rebase: clarify DESCRIPTION section Julia Evans via GitGitGadget
2025-08-11 20:12 ` [PATCH v5 1/5] doc: git-rebase: start with an example Julia Evans via GitGitGadget
2025-08-11 20:50 ` Junio C Hamano
2025-08-11 20:12 ` [PATCH v5 2/5] doc: git rebase: dedup merge conflict discussion Julia Evans via GitGitGadget
2025-08-11 20:12 ` [PATCH v5 3/5] doc: git rebase: clarify arguments syntax Julia Evans via GitGitGadget
2025-08-11 20:12 ` [PATCH v5 4/5] doc: git-rebase: move --onto explanation down Julia Evans via GitGitGadget
2025-08-11 20:12 ` [PATCH v5 5/5] doc: git-rebase: update discussion of internals Julia Evans via GitGitGadget
2025-08-11 21:14 ` Junio C Hamano
2025-08-11 21:51 ` [PATCH v6 0/5] doc: git-rebase: clarify DESCRIPTION section Julia Evans via GitGitGadget
2025-08-11 21:51 ` [PATCH v6 1/5] doc: git-rebase: start with an example Julia Evans via GitGitGadget
2025-08-11 21:51 ` [PATCH v6 2/5] doc: git rebase: dedup merge conflict discussion Julia Evans via GitGitGadget
2025-08-11 21:51 ` [PATCH v6 3/5] doc: git rebase: clarify arguments syntax Julia Evans via GitGitGadget
2025-08-11 21:51 ` [PATCH v6 4/5] doc: git-rebase: move --onto explanation down Julia Evans via GitGitGadget
2025-08-11 21:51 ` [PATCH v6 5/5] doc: git-rebase: update discussion of internals Julia Evans via GitGitGadget
2025-08-11 22:10 ` Junio C Hamano
2025-08-11 22:42 ` Julia Evans
2025-08-11 21:59 ` [PATCH v6 0/5] doc: git-rebase: clarify DESCRIPTION section Junio C Hamano
2025-08-12 13:49 ` [PATCH v7 " Julia Evans via GitGitGadget
2025-08-12 13:49 ` [PATCH v7 1/5] doc: git-rebase: start with an example Julia Evans via GitGitGadget
2025-08-12 13:49 ` [PATCH v7 2/5] doc: git rebase: dedup merge conflict discussion Julia Evans via GitGitGadget
2025-08-12 13:49 ` [PATCH v7 3/5] doc: git rebase: clarify arguments syntax Julia Evans via GitGitGadget
2025-08-12 13:49 ` [PATCH v7 4/5] doc: git-rebase: move --onto explanation down Julia Evans via GitGitGadget
2025-08-12 13:49 ` [PATCH v7 5/5] doc: git-rebase: update discussion of internals Julia Evans via GitGitGadget
2025-08-14 21:28 ` Junio C Hamano
2025-08-15 16:52 ` [PATCH v8 0/5] doc: git-rebase: clarify DESCRIPTION section Julia Evans via GitGitGadget
2025-08-15 16:52 ` [PATCH v8 1/5] doc: git-rebase: start with an example Julia Evans via GitGitGadget
2025-08-15 16:52 ` [PATCH v8 2/5] doc: git rebase: dedup merge conflict discussion Julia Evans via GitGitGadget
2025-08-15 16:52 ` [PATCH v8 3/5] doc: git rebase: clarify arguments syntax Julia Evans via GitGitGadget
2025-08-15 16:52 ` [PATCH v8 4/5] doc: git-rebase: move --onto explanation down Julia Evans via GitGitGadget
2025-08-15 21:05 ` Junio C Hamano
2025-08-18 13:42 ` Phillip Wood
2025-08-18 17:06 ` Junio C Hamano
2025-08-19 15:03 ` Julia Evans
2025-08-19 19:45 ` Junio C Hamano
2025-08-15 16:52 ` [PATCH v8 5/5] doc: git-rebase: update discussion of internals Julia Evans via GitGitGadget
2025-08-18 13:43 ` [PATCH v8 0/5] doc: git-rebase: clarify DESCRIPTION section Phillip Wood
2025-08-23 0:42 ` [PATCH v9 " Julia Evans via GitGitGadget
2025-08-23 0:42 ` [PATCH v9 1/5] doc: git-rebase: start with an example Julia Evans via GitGitGadget
2025-08-23 0:42 ` [PATCH v9 2/5] doc: git rebase: dedup merge conflict discussion Julia Evans via GitGitGadget
2025-08-23 0:43 ` [PATCH v9 3/5] doc: git rebase: clarify arguments syntax Julia Evans via GitGitGadget
2025-08-23 0:43 ` [PATCH v9 4/5] doc: git-rebase: move --onto explanation down Julia Evans via GitGitGadget
2025-08-23 0:43 ` [PATCH v9 5/5] doc: git-rebase: update discussion of internals Julia Evans via GitGitGadget
2025-08-13 13:31 ` [PATCH v6 0/5] doc: git-rebase: clarify DESCRIPTION section Phillip Wood
2025-08-13 15:33 ` Julia Evans
2025-08-14 21:18 ` Junio C Hamano
2025-08-15 10:25 ` Phillip Wood
2025-08-15 15:45 ` Junio C Hamano
2025-08-15 15:54 ` Phillip Wood
2025-08-15 15:56 ` Julia Evans
2025-08-15 10:25 ` Phillip Wood
2025-08-09 15:04 ` [PATCH v2 " D. Ben Knoble
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=xmqqbjopfpiy.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=julia@jvns.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).