From: Junio C Hamano <gitster@pobox.com>
To: "D. Ben Knoble" <ben.knoble@gmail.com>
Cc: Julia Evans via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org,
Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>,
Julia Evans <julia@jvns.ca>
Subject: Re: [PATCH v4] doc: checkout: rewrite detached HEAD state explanation
Date: Sat, 07 Nov 2026 20:25:35 -0800 [thread overview]
Message-ID: <xmqq7bio6jb4.fsf@gitster.g> (raw)
In-Reply-To: <CALnO6CBGcG42NxtpuPaJVrzAMC=J8iVstsHCSi6vDQhDmFJ-Kw@mail.gmail.com> (D. Ben Knoble's message of "Sat, 7 Nov 2026 15:06:36 -0500")
"D. Ben Knoble" <ben.knoble@gmail.com> writes:
> +`HEAD` is where Git stores your current branch or commit. `HEAD` can either be:
> +
> +1. A branch, which is your current branch.
> +2. A commit ID, when you don't have a current branch.
> + This is called "detached HEAD state".
> +
> +It can sometimes be useful for `HEAD` to be a commit ID, because
> +it lets you easily check out an old version of your project. For
> +example, a data scientist could use this to run an old version of a
> +data pipeline or a programmer could use this to figure out when a bug
> +was introduced.
> ...
> There are some quotes which use the "it's the parent of the next
> commit" mental model, though, so we could include a comment on that?
"From which your current changes started" is exactly that. HEAD is
where you started from (and can come back to, if you get lost after
botching your working tree state). Your next commit is built on top
of it, and then that new commit becomes your current commit.
This is why it is useful for users to realize that HEAD is simply
where you started from, regardless of where you are going.
> The second paragraphs differ a bit, with Junio's containing some bits
> about clobbering extant branches and not needing temporary branches. I
> think we could work something in there, like
> ...
> this to figure out when a bug was introduced. By detaching
> `HEAD`, you don't need to worry about clobbering an existing
> branch or creating a temporary branch.
>
> ? I suppose we could also be more explicit ("build, run, and
> experiment"), if we wanted, but this is a good example to start from.
I assume you mean the last two lines? I do appreciate that addition.
However, we should avoid saying "useful for HEAD to be a commit ID".
Being a commit ID is not the notable characteristic of a detached
HEAD; the fact that it directly refers to a commit is what gives us
these useful features. Recording a hexadecimal commit object name
(instead of a refname of a branch) is a mere implementation detail
of that direct reference.
Since Julia's introductory paragraph already established the term
"detached HEAD" very well, there is no need to resort to a roundabout
phrasing like "useful for HEAD to be a commit ID". I suggest
rewriting the beginning of that paragraph to start with:
It can be useful for the HEAD to be directly refering to a
commit (instead of indirectly referring to a commit by naming
the current branch).
This introduces the remainder of her paragraph much better, and
makes your addition about not needing to worry about clobbering
existing branches or consuming temporary refs easier to understand.
> Otherwise, we're approaching a finish here?
I hope so. The document overall is moving in the right direction,
and I just want to see these minor technical descriptions improved.
next prev parent reply other threads:[~2026-11-08 4:25 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-07 14:52 [PATCH] doc: checkout: rewrite detached HEAD state explanation Julia Evans via GitGitGadget
2026-10-07 16:43 ` Junio C Hamano
2026-10-13 12:54 ` Julia Evans
2026-10-19 14:05 ` Julia Evans
2026-10-19 21:24 ` Junio C Hamano
2026-10-20 12:52 ` Julia Evans
2026-10-20 13:06 ` Julia Evans
2026-10-07 19:02 ` Kristoffer Haugsbakk
2026-10-13 11:48 ` Julia Evans
2026-10-13 12:20 ` Kristoffer Haugsbakk
2026-10-13 12:27 ` Julia Evans
2026-10-13 12:42 ` Julia Evans
2026-10-13 13:01 ` [PATCH v2] " Julia Evans via GitGitGadget
2026-10-14 18:52 ` Junio C Hamano
2026-10-14 21:10 ` Julia Evans
2026-10-15 20:58 ` [PATCH v3] " Julia Evans via GitGitGadget
2026-10-15 22:39 ` Junio C Hamano
2026-10-16 14:55 ` Julia Evans
2026-10-16 17:03 ` Junio C Hamano
2026-10-16 18:35 ` Julia Evans
2026-10-16 19:05 ` Junio C Hamano
2026-10-16 19:03 ` [PATCH v4] " Julia Evans via GitGitGadget
2026-10-16 21:10 ` Junio C Hamano
2026-11-07 20:06 ` D. Ben Knoble
2026-11-08 4:25 ` Junio C Hamano [this message]
2026-11-09 21:48 ` Julia Evans
2026-11-10 6:46 ` Junio C Hamano
2026-11-10 13:13 ` Julia Evans
2026-11-11 21:45 ` Julia Evans
2026-11-12 1:58 ` Ben Knoble
2026-11-12 15:40 ` Junio C Hamano
2026-11-12 16:37 ` Julia Evans
2026-11-12 19:25 ` Junio C Hamano
2026-11-12 22:45 ` Julia Evans
2026-10-16 22:02 ` Junio C Hamano
2026-11-11 21:34 ` [PATCH v5] " Julia Evans via GitGitGadget
2026-11-11 23:14 ` Junio C Hamano
2026-11-12 0:01 ` Julia Evans
2026-11-12 4:08 ` Junio C Hamano
2026-11-12 22:47 ` [PATCH v6] " Julia Evans via GitGitGadget
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=xmqq7bio6jb4.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=ben.knoble@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=julia@jvns.ca \
--cc=kristofferhaugsbakk@fastmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.