Re: [PATCH v5] doc: add an explanation of Git's data model
- From
Julia Evans <julia@jvns.ca>
- Date
- Nov 4, 2025, 21:24 UTC
- Message-ID
- <5ac4f09e-927c-4125-adea-f7d5ed3d1caf@app.fastmail.com>
- In-Reply-To
- <xmqq346tpliw.fsf@gitster.g>
On Tue, Nov 4, 2025, at 3:53 PM, Junio C Hamano wrote:
Show 31 quoted lines
> "Julia Evans" <julia@jvns.ca> writes:
>
>> The problem with "A branch refers to a commit object (by its ID)." is
>
> Ah, I didn't mean to say "you must use exactly that phrase".
>
> But branch refers to a commit object, it does not refer to the name
> of a commit object.
>
> Perhaps "a branch ref records the object name of a commit object",
> would be better? The untold implication of the phrasing is that
> anybody who reads what is recorded by that ref can then use the
> result to refer to (find) the commit object.
>
>> it introduces some more potential for confusion: it makes it
>> sound like there might be other ways to refer to a commit object
>> than by its ID.
>
> Yes, there are unbound number of ways to refer to a commit object.
>
> $ git show-ref refs/heads/maint
> bb5c624209fcaebd60b9572b2cc8c61086e39b57 refs/heads/maint
>
> The branch ref let you refer to a commit object by recording its
> commit object name bb5c6242, but for humans, it is much easier to
> refer to the same commit as "v2.51.2^{commit}", which is far more
> memorable. Of course I can use master~32^2 to call the same commit
> object, which is less memorable gives us a hint that the tip of
> master fully contains that maintenance release. What's more useful
> depends on how the name will be used, and the hexadecimal object
> names happen to be how refs record the objects they refer to.I'm aware that there are other ways to refer to a commit other than its ID, but as far as I know literally every other way to refer to a commit eventually ends up going through the commit ID to retrieve the commit.
For example you could use `master^32`. but presumably what that does is to find `master`, look up the commit ID for `master`, and then go through 32 parents until it finds the appropriate commit ID and then looks up the object corresponding to that ID
I do not see the point of implying that the commit ID is not "special", or that it's only one of many ways to find a commit because to me it seems very special, since there is no way I know of to retrieve a commit that doesn't ultimately end up using the commit ID at some point. (though that ID might not be encoded in hexadecimal)