Re: [PATCH v4] doc: checkout: rewrite detached HEAD state explanation
On 2026-11-12 10:40 a.m., Junio C Hamano wrote:
Show 24 quoted lines
> 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.
Thanks, this is helpful, it makes sense now why this would be useful to you as the Git maintainer with what I've learned about your workflow.
Show 5 quoted lines
> 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.
I'm not sure what you mean by "it requires a developer's mindset", in my time working as a developer using Git I never ran into a case where I would have needed to clobber a branch in this way :)
It's important to remember that different Git users can have very different workflows (especially among developers, I think!) and that one person's workflow may not generalize well to other developers.
This is something I pay a lot of attention to in my own work: some parts of my own personal workflow are a bit unusual and I keep a mental catalog of those things to avoid giving them as advice.
> It is in a developer's heart ;-).
>
> Hope this clarifies.