From: Junio C Hamano <gitster@pobox.com>
To: "Julia Evans" <julia@jvns.ca>
Cc: "D. Ben Knoble" <ben.knoble@gmail.com>,
"Julia Evans" <gitgitgadget@gmail.com>,
git@vger.kernel.org,
"Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com>
Subject: Re: [PATCH v4] doc: checkout: rewrite detached HEAD state explanation
Date: Mon, 09 Nov 2026 22:46:48 -0800 [thread overview]
Message-ID: <xmqqfqx9uqsn.fsf@gitster.g> (raw)
In-Reply-To: <f7d4600b-909f-4dd7-94da-d525649a9546@app.fastmail.com> (Julia Evans's message of "Mon, 09 Nov 2026 16:48:36 -0500")
"Julia Evans" <julia@jvns.ca> writes:
> On Sat, Nov 7, 2026, at 11:25 PM, Junio C Hamano wrote:
>> "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".
> ...
> Saying "it's a commit ID" is a simple way to say that it directly refers
> to a commit in a small number of words. I'm not sure what your goal is
> here, do you think that statement is somehow misleading to users?
Yes, I find it highly misleading, and otherwise I wouldn't be
discussing this patch.
I think the part I find it problematic the most in
HEAD is a branch vs HEAD is a commit ID
is that HEAD *IS NOT* either of these things. HEAD may record one
of these kinds of things but it never is a branch or an commit
object name.
And HEAD records one of these kinds of things to either directly or
indirectly refer to a commit that is currently checked out.
That is why I want to see the first description of the above to
serve as a solid base to convey these points, with later
descriptions we build on top:
* `HEAD` can record either (1) a branch, or (2) a commit object
name.
* The purpose of HEAD doing so is to refer to a commit that is
currently checked out, either directly or indirectly.
* The latter (i.e., the direct reference) may be unfamiliar to
users. It is called "detached HEAD" state.
* The commit referred to by the HEAD will become the parent of the
commit you create. When your HEAD records a branch, its tip is
advanced. Otherwise no branch is affected. Either case, HEAD
now refers to the commit you newly created.
And I find that saying "HEAD is a branch" or "HEAD is a commit" is
misleading and does not help that goal.
HTH.
next prev parent reply other threads:[~2026-11-10 6:46 UTC|newest]
Thread overview: 37+ 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
2026-11-09 21:48 ` Julia Evans
2026-11-10 6:46 ` Junio C Hamano [this message]
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-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
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=xmqqfqx9uqsn.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox