Subject: Re: [PATCH v2] doc: add a explanation of Git's data model

From: "Julia Evans" <[email-masked]>
Date: Tue, 14 Oct 2025 05:18:58 -0400

On Tue, Oct 14, 2025, at 1:45 AM, Patrick Steinhardt wrote:
> On Mon, Oct 13, 2025 at 07:48:15AM -0700, Junio C Hamano wrote:
>> Patrick Steinhardt <[email-masked]> writes:
>> > On Wed, Oct 08, 2025 at 01:53:41PM +0000, Julia Evans via GitGitGadget wrote:
>> > [snip]
>> > Not quite true. Pseudo refs are outside the hierarchy and are in fact
>> > treated differently. But root refs are treated the same as any other
>> > reference.
>> >
>> >     References are stored in a hierarchy. While most references are
>> >     stored in the "refs/" hierarchy, some references with special
>> >     meaning like for example "HEAD" are stored directly in the root of
>> >     the hierarchy.
>> >
>> > I don't really think we should get into root refs vs pseudo refs here,
>> > so maybe this is sufficient?
>> 
>> I do not think "root ref" (or pseudo for that matter) is a concept
>> that has no use in this context.  If this is really about data
>> model, where you find refs (or what the "pathname looking" thing
>> exactly look like that names your refs) should be immaterial.  It
>> does help to know that HEAD is just a ref.  It also would help to
>> know there are symbolic refs that point at other refs, which is much
>> more relevant to the data model.
>
> Yeah, I don't necessarily think that we need to mention root refs here.
> But what I think we need to avoid is the following sentence, as it is
> misleading:
>
>     References are stored in a hierarchy, and Git handles references
>     differently based on where they are in the hierarchy.
>

Why do you say that it’s misleading? (what do you think it’s implying that is not true?)

What i’m trying to communicate is that branches, tags, etc are treated differently from each other and that Git knows how to handle them based on where they are in the hierarchy.

> Pseudo refs are stored outside of the hierarchy and are indeed handled
> differently. But root refs are stored outside of the hierarchy and are
> treated the same as any other ref, even though they of course have
> special meaning to some commands.
>
> So maybe something like this would be preferable:
>
>     References are stored in a hierarchy. References that sit at the
>     root of the hierarchy often have special meaning to Git commands,
>     like for example "HEAD" or "REBASE_HEAD".
>
> It hints at the fact that these references are special, but not in how
> they are handled but rather in what they mean. It doesn't go into our
> two pseudo refs at all, but given that there's only FETCH_HEAD and
> MERGE_HEAD I don't think we should explain them. The water is getting
> somewhat murky around pseudorefs anyway, so it probably only causes more
> confusion.
> Patrick