git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v6] doc: add an explanation of Git's data model

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 8, 2025, 19:43 UTC
Message-ID
<xmqqh5v448fr.fsf@gitster.g>
In-Reply-To
<xmqqo6pde90w.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 54 quoted lines
> "Julia Evans" <julia@jvns.ca> writes:
>
>> I wonder if it would help to de-emphasize the octal representation
>> of the file modes, and instead give them names since (from a
>> data model section Git's file modes are really more like an enum with
>> 5 values than )
>>
>> Something like this:
>>
>> 	Git has 5 file modes:
>>
>> 	  - *regular file* (with <<object,object type>> `blob`)
>> 	  - *executable file* (with type `blob`)
>> 	  - *symbolic link* (with type `blob`)
>> 	  - *directory* (with type `tree`)
>> 	  - *gitlink*, for use with submodules (with type `commit`)
>>
>> 	NOTE: Git normally displays file modes in the same format as Unix file modes
>> 	(100644, 100755, 120000, 040000, and 160000 respectively), but file modes are
>> 	only spiritually related to Unix file modes.
>
> Then, I would suggest further deemphasize the "file modes" even
> more.  
>
>     * Git stores/tracks 5 different file types, which are
>       non-executable files, executable files, symbolic links,
>       directories, and gitlinks.
>
>     * Git uses one bitpattern each to mark these 5 different kinds
>       of things in tree objects.  These bitpatterns were loosely
>       modelled after UNIX file mode bits.
>
> The first half entirely avoids saying "mode" and that is very
> deliberate.
>
>>> Another thing we discussed and a better alternative offered during
>>> the last round was "base directory", to which Patrick mentioned 
>>> "we rather consistently use 'root tree'"
>>>
>>>  cf. https://lore.kernel.org/git/aQhcbHJjiI5GtV6Y@pks.im/
>>
>> I think it would be better to stick with "directory" here, because I've gotten
>> several reader comments saying that they do not understand the
>> term "tree" when it is used as a synonym for "directory".
>>
>> Maybe "root directory"?
>
> I am OK with "root" but that is conditional; only if it is not used
> together with the word "directory".  We are not talking about "root
> directory" where common directories like /usr, /etc, /dev and /tmp
> hang immediately below.  If we use the word "directory", I'd
> strongly prefer to see it with adjective like "top-level" that
> implies that it is something different from "root directory" but is
> relative to the project in question.

The above two points should probably be trivial to address. I've already squashed in the xml validation fixes to [v6], so let's finish the rest quickly.

I have no more words to offer somebody, who says she does not know why saying "branch records ID of the commit it refers to" is an improvement over "branch refers to ID of the commit", when she already accepts that "The *ID* of the object it references" is a better way than "The object *ID* it references" to describe one of the fields in an annotated tag object. So I wouldn't mind if v7 still said "branch refers to commit id". We can update it with follow-up series as needed, and it is not worth blocking the rest of the document.

Refs (including branches), refer to objects exactly the same way an annotated tag refers to another object, or a tree entry in a tree object refers to a blob, tree, or a commit object. Recording the hexadecimal hash is an implementation detail of the way how they reference the object, and the phrasing used for the tag field in an annotated tag reflects that by clearly distinguishing

 - recording the ID 
 - referring to the object

as two separate things. The former is merely a means to the end which is the latter, i.e. the purpose of refs, tree-entry in a tree, tag field in a tag object, and all other things that refer to an object by recording its ID.

Previous: Junio C HamanoNext: Ben Knoble
Message 69 of 89 in “doc: add a explanation of Git's data model”
  1. doc: add a explanation of Git's data modelJulia Evans via GitGitGadget, Oct 3, 2025
  2. Kristoffer HaugsbakkOct 3, 2025
  3. Julia EvansOct 6, 2025
  4. D. Ben KnobleOct 6, 2025
  5. Julia EvansOct 6, 2025
  6. D. Ben KnobleOct 6, 2025
  7. Julia EvansOct 9, 2025
  8. Kristoffer HaugsbakkOct 8, 2025
  9. Junio C HamanoOct 6, 2025
  10. Julia EvansOct 6, 2025
  11. Kristoffer HaugsbakkOct 7, 2025
  12. Junio C HamanoOct 7, 2025
  13. Patrick SteinhardtOct 7, 2025
  14. Junio C HamanoOct 7, 2025
  15. Julia EvansOct 7, 2025
  16. Junio C HamanoOct 7, 2025
  17. D. Ben KnobleOct 7, 2025
  18. Julia EvansOct 7, 2025
  19. Patrick SteinhardtOct 8, 2025
  20. Junio C HamanoOct 8, 2025
  21. Julia EvansOct 8, 2025
  22. doc: add a explanation of Git's data modelJulia Evans via GitGitGadget, Oct 8, 2025
  23. Patrick SteinhardtOct 10, 2025
  24. Junio C HamanoOct 13, 2025
  25. Patrick SteinhardtOct 14, 2025
  26. Julia EvansOct 14, 2025
  27. Patrick SteinhardtOct 14, 2025
  28. Junio C HamanoOct 14, 2025
  29. doc: add a explanation of Git's data modelJulia Evans via GitGitGadget, Oct 14, 2025
  30. Patrick SteinhardtOct 15, 2025
  31. Junio C HamanoOct 15, 2025
  32. Julia EvansOct 15, 2025
  33. Junio C HamanoOct 15, 2025
  34. Julia EvansOct 16, 2025
  35. Junio C HamanoOct 15, 2025
  36. Julia EvansOct 16, 2025
  37. Junio C HamanoOct 16, 2025
  38. Julia EvansOct 16, 2025
  39. Junio C HamanoOct 16, 2025
  40. Kristoffer HaugsbakkOct 16, 2025
  41. Kristoffer HaugsbakkOct 20, 2025
  42. Junio C HamanoOct 20, 2025
  43. doc: add an explanation of Git's data modelJulia Evans via GitGitGadget, Oct 27, 2025
  44. Junio C HamanoOct 27, 2025
  45. Julia EvansOct 28, 2025
  46. Junio C HamanoOct 28, 2025
  47. doc: add an explanation of Git's data modelJulia Evans via GitGitGadget, Oct 30, 2025
  48. Junio C HamanoOct 31, 2025
  49. Patrick SteinhardtNov 3, 2025
  50. Junio C HamanoNov 3, 2025
  51. Julia EvansNov 3, 2025
  52. Junio C HamanoNov 4, 2025
  53. Julia EvansNov 4, 2025
  54. Junio C HamanoNov 4, 2025
  55. Julia EvansNov 4, 2025
  56. Junio C HamanoNov 4, 2025
  57. Julia EvansNov 5, 2025
  58. Ben KnobleNov 5, 2025
  59. Julia EvansNov 5, 2025
  60. Ben KnobleNov 6, 2025
  61. Junio C HamanoOct 31, 2025
  62. Patrick SteinhardtNov 3, 2025
  63. Julia EvansNov 3, 2025
  64. doc: add an explanation of Git's data modelJulia Evans via GitGitGadget, Nov 7, 2025
  65. Junio C HamanoNov 7, 2025
  66. Junio C HamanoNov 7, 2025
  67. Julia EvansNov 7, 2025
  68. Junio C HamanoNov 7, 2025
  69. Junio C HamanoNov 8, 2025
  70. Ben KnobleNov 9, 2025
  71. Junio C HamanoNov 9, 2025
  72. Julia EvansNov 10, 2025
  73. Junio C HamanoNov 11, 2025
  74. Ben KnobleNov 11, 2025
  75. Julia EvansNov 11, 2025
  76. Junio C HamanoNov 12, 2025
  77. Junio C HamanoNov 12, 2025
  78. Julia EvansNov 13, 2025
  79. Junio C HamanoNov 13, 2025
  80. Julia EvansNov 13, 2025
  81. Chris TorekNov 13, 2025
  82. Junio C HamanoNov 13, 2025
  83. doc: add an explanation of Git's data modelJulia Evans via GitGitGadget, Nov 12, 2025
  84. Junio C HamanoNov 12, 2025
  85. Junio C HamanoNov 23, 2025
  86. Patrick SteinhardtDec 1, 2025
  87. Junio C HamanoDec 2, 2025
  88. Julia EvansOct 9, 2025
  89. Ben KnobleOct 10, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.