Article View: linux.kernel.git
Article #2993Re: [PATCH v4] doc: checkout: rewrite detached HEAD state explanation
From: Junio C Hamano
Date: Thu, 12 Nov 2026 15:40
Date: Thu, 12 Nov 2026 15:40
50 lines
15215 bytes
15215 bytes
Julia Evans <julia@jvns.ca> writes: > Yeah I agree the "it's the parent of the next commit" would be > distracting unless there's a specific reason we need to include it. > > I agree "the state from which your current changes started" isn't right > but I think if we reinterpret it as "the current commit you have checked > out" (which I think has the same or a very similar meaning) then it'll > seem familiar to folks and might even help. > ... > because I couldn't think of a reason why someone would clobber an > existing branch to check out an old version of their code. When I find something interesting in a topic, which may be an old commit from the point of view of 'seen', I would detach HEAD at the tip of the branch to take a look at its contents, because what I am going to do next would very often involve modifying the working tree files to experiment. Even a topic that is documentation only, like the je/doc-detached-head topic, can have a cascading effect that ends up breaking tests, for example, and I'd be futzing with the sources and tests to figure out what the best fix would be. Even though I am not going to make any permanent commits out of these efforts, being able to make temporary commits to mark a resumable state is handy, and when my spelunking gets longer, I do make such commits. But of course, I do *not* want to contaminate the topic branch I have been looking at. The work I do, whether it is for validation or for satisfying my own curiosity, does not necessarily align with the objective the topic author had in mind when they wrote it. This is where detached HEAD is the perfect mechanism to take advantage of. You do not want to clobber the branch you are going to start your journey at, yet you want to be able to make tentative changes to experiment, and you want to be able to take snapshots. And during the journey, your HEAD points at a commit from which your current changes started and points at a commit your next commit will record as its parent. I guess it requires a developer's mindset and imagination to appreciate why detached HEAD is useful while spelunking. We often phrase the act of visiting random commits (often older ones) as "sight-seeing", but in reality, even when you are mostly looking, you do want to futz with things you see there. It is in a developer's heart ;-). Hope this clarifies.
Technical Details
Message-ID:
<xmqq5wy2kqhl.fsf@gitster.g>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!git+bounces-75287-linux-kernel-git=dewy.ruReferences:
<pull.2250.git.1791384721919.gitgitgadget@gmail.com> <pull.2250.v4.git.1792177409868.gitgitgadget@gmail.com> <xmqqh5ile4h4.fsf@gitster.g> <CALnO6CBGcG42NxtpuPaJVrzAMC=J8iVstsHCSi6vDQhDmFJ-Kw@mail.gmail.com> <ddc6d42c-6e40-46a5-bb70-f89f11525ac4@jvns.ca>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!git+bounces-75287-linux-kernel-git=dewy.ru
From: gitster@pobox.com (Junio C Hamano)
Newsgroups: linux.kernel.git
Subject: Re: [PATCH v4] doc: checkout: rewrite detached HEAD state explanation
Date: Thu, 12 Nov 2026 07:40:22 -0800
Organization: Usenet Network
Message-ID: <xmqq5wy2kqhl.fsf@gitster.g>
References: <pull.2250.git.1791384721919.gitgitgadget@gmail.com>
<pull.2250.v4.git.1792177409868.gitgitgadget@gmail.com>
<xmqqh5ile4h4.fsf@gitster.g>
<CALnO6CBGcG42NxtpuPaJVrzAMC=J8iVstsHCSi6vDQhDmFJ-Kw@mail.gmail.com>
<ddc6d42c-6e40-46a5-bb70-f89f11525ac4@jvns.ca>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: usenet.network;
logging-data="1119934"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:xspv/fUtR4i+XTEB2inp67kUKYE= sha256:yWZn5bZ5LHrhRGX5vlhhSBKBmZlRsScyEAv3gTztsSg=
sha1:McwDIqjHmQBzJTRFAJsM6go3oZY= sha256:rgww2NGo/5ldFE4G+YWhdcWhk8bVTLHhVaSuI8lVBvo=
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 9CCB51142B7; Thu, 12 Nov 2026 18:57:51 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.051
X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=pobox.com header.b=hDilnkNQ; dkim=pass (2048-bit key)
header.d=messagingengine.com header.b=YaZcwMV+
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id dNzoCrCl7M26;
Thu, 12 Nov 2026 18:57:42 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-75287-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=pobox.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id EB0761142D5; Thu, 12 Nov 2026 18:57:27 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id ADC76690B7; Thu, 12 Nov 2026 15:40:27 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1794498027;
b=xMtnCqUBzw8Mqd5yptw5wETdPZTj0xswLGk4xKsjjnS2+pEXHpAFwI8v2tWRkJe9kZTQ
ZomlkVRFg4gfxDZuiuGRjudagjzrvzMQamcavnPb969fvZ51mmojcQ+qwUe4O9lLUDUbj
8XLB8Sy3mYX+nDeUu/6xt+nB2SQx6+eF3bS2jS+sXj6D0h8pyN9oDJc4eo/oU0dBoo8Rz
IRC5/HBkq0mYzbhyxdpfb6Q7tW0b3ktjCKG8BTUOv1CoXCRhnCG0aTbc28ol9P4ozZhZi
Z4FJWHxiS+WSezjVR5EJ8XZF2U0oZ0XV9IZs+vy0Qz6ooyr4RHowMH9eRQvfcscidYg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794498027;
h=X-Original-To:Received:DMARC-Filter:Received:Received:DKIM-Signature:
DKIM-Signature:X-DKIM2-Info:DKIM2-Signature:X-DKIM2-Info:
Message-Instance:X-ME-Sender:X-ME-Received:X-ME-Proxy-Cause:
X-ME-Proxy:Feedback-ID:Received:From:To:Cc:Subject:In-Reply-To:
References:Date:Message-ID:User-Agent:X-Mailing-List:List-Id:
List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
Precedence:MIME-Version:Content-Type;
bh=/kzDgX0iVeBxOE+BuUu0Md3BHoM3idePJgtkDUzt0Ow=;
b=TzEGmvPR8jnSU2ddRQppfSp93KH/rF1mBqcnM2lxplUpryW5g2SFQv2sWIAdX4CmweGH
xDTuHrdp3v/ffj4cuHiFN6qN2Qj5F/WRrQvemNn60JxWlxbonEJRonsLzRA/KSNrsU+MD
f1b5Hx7EhjzipCRH+XSYPetwTLSIc2b/yqKaypREPTwRhXtVGVb73DOc9TmIMQrp1JeKy
dQXiJXImhLl3DEpIDvDfK6wk7F08QaDZv9v9bJCug7U97K8zfRv4oHIKcR1liTub05fd9
uRLja+BAI8y0I90SrMtrJIWjv0lFmFzhcOidBCrNGeWdqTahkt9rLZbBdrmnZpaEtAw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=pobox.com header.i=@pobox.com header.a=rsa-sha256 header.s=fm2 header.b=hDilnkNQ;
dkim=pass header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=YaZcwMV+;
dmarc=pass header.from=pobox.com;
spf=pass smtp.mailfrom=pobox.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id E4A83606A335;
Thu, 12 Nov 2026 15:40:26 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key, unprotected) header.d=pobox.com header.i=@pobox.com header.a=rsa-sha256 header.s=fm2 header.b=hDilnkNQ;
dkim=pass (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=YaZcwMV+
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=103.168.172.154
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1794498026;
b=2yQAo24ZrK4YobESsbPJmGJXyu1Ntr1/3bjjCK305w39g/WFi7KnIuGqUTYPkbyWI+rp
WFvkKJUPZR7kaPUvmfjf9ILNhLhnikenKbA9Z4XkUueyZQRgd4alDSZ6764fWjTN7a9Zs
Y/DbuxW7eulAhdpgsok/Odc9wdBZXU18o9rhMdHQ86FPgLSSho0XQfgiAudRKe4+AyqwP
Hi0TlDo7QJn5B8Yl13TPeXCIdw9rnm93mQXeoBlB70MP5qveA0UrUh2nDCjsT9MOVFVV3
rr+fwygOMY4mOjzsScec0CtPQIfhbEk69+VOfwcHQiWNhu0FcwzsGYcyGB+V20JYtvQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794498026;
h=DMARC-Filter:Received:Received:DKIM-Signature:DKIM-Signature:
X-DKIM2-Info:DKIM2-Signature:X-DKIM2-Info:Message-Instance:
X-ME-Sender:X-ME-Received:X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID:
Received:From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID:
User-Agent:MIME-Version:Content-Type;
bh=/kzDgX0iVeBxOE+BuUu0Md3BHoM3idePJgtkDUzt0Ow=;
b=C5/7u2W6Weu+MX9Pv+kpmtA2F7BlmSYQ4+CRZnhLXqhMBBGD5WVnd9Zs/8CODBS/J1Kr
qkpJlkl2TWLuBmoopLubGY0pnQZ+eyrzBCKFtgP3mw+A+3wF7nNTUWnP6lRvLaHqiaL5A
uPavfa50orso31XRxr3xyRm03nwqrmUBmKgNZCTlnDLcrX1cEXUZDeRQvJpJApHLUEMQc
cS1VsGE+Qjw2A+++z0KXgZr7YzE25fvGUFY8M4H35L7u7485XzdcA9UKJkGMU6/nmyr/E
Ag2gvFps4E0bZinScTRTlu8Lc7mxT1vAOtzzl3ARbLN5eFteOugUm0O30l6tLjJCqfA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=pobox.com;
spf=pass smtp.mailfrom=pobox.com;
dkim=pass header.d=pobox.com header.i=@pobox.com header.a=rsa-sha256 header.s=fm2 header.b=hDilnkNQ;
dkim=pass header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=YaZcwMV+;
arc=none smtp.remote-ip=103.168.172.154
X-Received: from fhigh-a3-smtp.messagingengine.com (fhigh-a3-smtp.messagingengine.com [103.168.172.154])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature ECDSA (prime256v1))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7F57E606A31C
for <git@vger.kernel.org>; Thu, 12 Nov 2026 15:40:25 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7F57E606A31C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com
X-Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41])
by mailfhigh.phl.internal (Postfix) with ESMTP id 93DA114000D8
for <git@vger.kernel.org>; Thu, 12 Nov 2026 10:40:24 -0500 (EST)
X-Received: from phl-frontend-02 ([10.202.2.161])
by phl-compute-01.internal (MEProxy); Thu, 12 Nov 2026 10:40:24 -0500
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; h=cc
:cc:content-type:content-type:date:date:from:from:in-reply-to
:in-reply-to:message-id:mime-version:references:reply-to:subject
:subject:to:to; s=fm2; t=1794498024; x=1794584424; bh=/kzDgX0iVe
BxOE+BuUu0Md3BHoM3idePJgtkDUzt0Ow=; b=hDilnkNQF428jhK0fnz7Ki6z/n
FlmgY7xt5pUf3zp8gdfDbqrR4eo0T9LGU9m8eChBDXK2OG4I5/Nn4sQsF49y2GSs
dfJRRFgWeGbZBlY/IydivqlbqDmWqIQT0iP2KRgroTGxBJHKD4UXvkbCcbPJ6saR
r5uBTtL/t9rgNjl266AMTY/h05nDMVzXlaRZiapz97MqP7fbAgzILSFxO2qZLqWe
Y6d9oGHVr6Fpt3l8UFUvxsNTHZT9uEoX8l2iw9LolveRP8Oew+70/FHoYgNsLKNx
cOn/aTi2f7jbP+NCjSvBfpfNhNeIxQq74ewO3m6SH4w27Mb2puL9RGoezY5Q==
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
messagingengine.com; h=cc:cc:content-type:content-type:date:date
:feedback-id:feedback-id:from:from:in-reply-to:in-reply-to
:message-id:mime-version:references:reply-to:subject:subject:to
:to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=
1794498024; x=1794584424; bh=/kzDgX0iVeBxOE+BuUu0Md3BHoM3idePJgt
kDUzt0Ow=; b=YaZcwMV+Z16HMrSFRg0s5p6eXHx0ImCg8w+UpB7hoZGr/qBgAaB
NovXjI66vmlhEvlhSSHdkm+z7RxvtTjUQ5qjcgNwq6dp4aXBzV1lOMPu3/ARAYt7
ueO4UqFYc6YksQz+U8Rl1F/MEd/CaBCo8GpYkkXzVvfSdnXBE3MEFtoNNkDwTKuY
78KdZaBtIYYTaIUseSZHfFhY8qxESm07CW9lHuo/bGW0S66MkDkpHuEeDmJPQJWh
HpzTtcZpmpGgv+C4/qFiBhhMUoPNlqsO57fyAgiAgvITnWeMZgDLKAqQkJKYikZ6
zB18IPXUpC+MUvnCmat2LK+Dq+7ww71piDQ==
X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09;
repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox;
action=sign d=pobox.com a=rsa-sha256;
X-DKIM2-Signature: i=1; m=1; t=1794498024; d=pobox.com;
mf=PGdpdHN0ZXJAcG9ib3guY29tPg==;
rt=PGdpdEB2Z2VyLmtlcm5lbC5vcmc+;
s=fm2:rsa-sha256:MqPhbbQCCPaFqpALk/wVGyp0AwYSvP3Oj9gIsShy6kyfr4b
4YbVl5oH50FaLpCzldhuiAogRgoFemlT4UE0xOEfjPTQ1DtWtjXuGjULsaqU2msi
Rk1jJM2YUpcc/bcouaKDeiyUvxNMLEhUYPH6E0c44qYLIfhKe07xCfjuZRhX+yy0
Hn3uHXxJkJba9kj6i+9N0sEKqk6VbEqDeU6u7TKB0hagoX0Ok0KipCrCrzZN7zc+
XvgTtt0M68/c0/+mf8cKYvXEz1DErDWrJviuEaA/3dmOAAnc8J4VvX6FTVF2aXKM
E4Qqr+FzT7/L77KnsCyyO5jgIQNMBAoau6+fTGQ==;
X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09;
repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox;
action=mi-m=1; hc=12;
hn=cc,content-type,date,feedback-id,from,in-reply-to,message-id,
mime-version,references,subject,to,user-agent;
X-Message-Instance: m=1; h=sha256:4UZkqkdGruuTjGugW7GAtRo+z6M78W/CXt5oTX5JEe4=:6I68RqmJEDr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BEhd5jQg99OMSlnM1EuIisSyPC84Sgf8uBjuWLJI5Dubw>
<xmx:6N31aj6r5KyCEBceLlMOecTlQZ3Tl-dBuAaYOrmP8ApAXaoexR5asg>
<xmx:6N31agQUZ75qg-Hxow6ySrXQHvOkubhPnTrvt50othIqZN51W20kEw>
<xmx:6N31agAiXZhrW2neggO2ljSSpvo8ZDXKPTjtwM8qhm8ETvmvfipZNg>
<xmx:6N31auzYslyV1vPPJCnIwbP4SuxMYjyOdCNcmb4MI3VxfFWiMuDeCzXT>
X-Feedback-ID: if26b431b:Fastmail
X-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu,
12 Nov 2026 10:40:24 -0500 (EST)
X-Cc: "D. Ben Knoble" <ben.knoble@gmail.com>, Julia Evans via GitGitGadget
<gitgitgadget@gmail.com>, git@vger.kernel.org, Kristoffer Haugsbakk
<kristofferhaugsbakk@fastmail.com>
X-In-Reply-To: <ddc6d42c-6e40-46a5-bb70-f89f11525ac4@jvns.ca> (Julia Evans's
message of "Wed, 11 Nov 2026 16:45:34 -0500")
X-User-Agent: Gnus/5.13 (Gnus v5.13)
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list