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

From: Junio C Hamano <[email-masked]>
Date: Wed, 15 Oct 2025 08:34:08 -0700

Patrick Steinhardt <[email-masked]> writes:

>> +Like all other objects, commits can never be changed after they're created.
>> +For example, "amending" a commit with `git commit --amend` creates a new
>> +commit with the same parent.
>
> Let's say "parents" instead of "parent" here so that it also works for
> root and merge commits.

I just found it amusing that parents can be 0 ;-)

>> +NOTE: By default, Git references are stored as files in the `.git` directory.
>> +For example, the branch `main` is stored in `.git/refs/heads/main`.
>> +This means that you can't have branches named both `maya` and `maya/some-task`,
>> +because there can't be a file and a directory with the same name.
>
> Hm. I think mentioning this can help, but it may also creates questions
> when someone has a "main" branch but is unable find it in
> ".git/refs/heads/main" because it has either been packed, or because the
> repository uses reftables.

I had the same thought.  The only thing we want to stress here is
that the names of refs _behave_ like filesystem entities.  So how
about saying just

    Note: when you have a branch with <name>, you cannot have any
    branch whose name begins with "<name>/".

and stop at it?  It may look like an arbitrary limitation, and once
in a distant future ref-files gets retired, it will become one (as
there is no inherent reason why reftable backend must retain it; it
only enforces the same limitation to ensure that the names it stores
interoperate with another clone that uses ref-files backend).  At
the data-model level (which is the theme of this document), it is
just as immaterial as refnames may be case insensitive on some
systems.

Mentioning the limitation may be good, but the data model document
is not the right place to explain where this limitation comes from
(i.e. to be compatible with and expressible in ref-files backend).
We do not say "you may not be able to have 'maya' branch and 'mAYa'
branch at the same time on some systems", either ;-).

>> +Git stores a history called a "reflog" for every branch, remote-tracking
>
> I think it's a bit unclear what "history" means here. Maybe:

"records of updates", perhaps?