doc: add an explanation of Git's data model

Git very often uses the terms "object", "reference", or "index" in its
documentation.

However, it's hard to find a clear explanation of these terms and how
they relate to each other in the documentation. The closest candidates
currently are:

1. `gitglossary`. This makes a good effort, but it's an alphabetically
    ordered dictionary and a dictionary is not a good way to learn
    concepts. You have to jump around too much and it's not possible to
    present the concepts in the order that they should be explained.
2. `gitcore-tutorial`. This explains how to use the "core" Git commands.
   This is a nice document to have, but it's not necessary to learn how
   `update-index` works to understand Git's data model, and we should
   not be requiring users to learn how to use the "plumbing" commands
   if they want to learn what the term "index" or "object" means.
3. `gitrepository-layout`. This is a great resource, but it includes a
   lot of information about configuration and internal implementation
   details which are not related to the data model. It also does
   not explain how commits work.

The result of this is that Git users (even users who have been using
Git for 15+ years) struggle to read the documentation because they don't
know what the core terms mean, and it's not possible to add links
to help them learn more.

Add an explanation of Git's data model. Some choices I've made in
deciding what "core data model" means:

1. Omit pseudorefs like `FETCH_HEAD`, because it's not clear to me
   if those are intended to be user facing or if they're more like
   internal implementation details.
2. Don't talk about submodules other than by mentioning how they
   relate to trees. This is because Git has a lot of special features,
   and explaining how they all work exhaustively could quickly go
   down a rabbit hole which would make this document less useful for
   understanding Git's core behaviour.
3. Don't discuss the structure of a commit message
   (first line, trailers etc).
4. Don't mention configuration.
5. Don't mention the `.git` directory, to avoid getting too much into
   implementation details

Signed-off-by: Julia Evans <julia@jvns.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 files changed
tree: adf3f3e4a398923f58c38fc51e91a2d50f287b46
  1. .github/
  2. bin-wrappers/
  3. block-sha1/
  4. builtin/
  5. ci/
  6. compat/
  7. compiler-tricks/
  8. contrib/
  9. Documentation/
  10. ewah/
  11. git-gui/
  12. gitk-git/
  13. gitweb/
  14. mergetools/
  15. negotiator/
  16. oss-fuzz/
  17. perl/
  18. po/
  19. refs/
  20. reftable/
  21. sha1/
  22. sha1dc/
  23. sha256/
  24. subprojects/
  25. t/
  26. templates/
  27. trace2/
  28. xdiff/
  29. .cirrus.yml
  30. .clang-format
  31. .editorconfig
  32. .gitattributes
  33. .gitignore
  34. .gitlab-ci.yml
  35. .gitmodules
  36. .mailmap
  37. .tsan-suppressions
  38. abspath.c
  39. abspath.h
  40. aclocal.m4
  41. add-interactive.c
  42. add-interactive.h
  43. add-patch.c
  44. advice.c
  45. advice.h
  46. alias.c
  47. alias.h
  48. alloc.c
  49. alloc.h
  50. apply.c
  51. apply.h
  52. archive-tar.c
  53. archive-zip.c
  54. archive.c
  55. archive.h
  56. attr.c
  57. attr.h
  58. banned.h
  59. base85.c
  60. base85.h
  61. bisect.c
  62. bisect.h
  63. blame.c
  64. blame.h
  65. blob.c
  66. blob.h
  67. bloom.c
  68. bloom.h
  69. branch.c
  70. branch.h
  71. builtin.h
  72. bundle-uri.c
  73. bundle-uri.h
  74. bundle.c
  75. bundle.h
  76. cache-tree.c
  77. cache-tree.h
  78. cbtree.c
  79. cbtree.h
  80. chdir-notify.c
  81. chdir-notify.h
  82. check-builtins.sh
  83. checkout.c
  84. checkout.h
  85. chunk-format.c
  86. chunk-format.h
  87. CODE_OF_CONDUCT.md
  88. color.c
  89. color.h
  90. column.c
  91. column.h
  92. combine-diff.c
  93. command-list.txt
  94. commit-graph.c
  95. commit-graph.h
  96. commit-reach.c
  97. commit-reach.h
  98. commit-slab-decl.h
  99. commit-slab-impl.h
  100. commit-slab.h
  101. commit.c
  102. commit.h
  103. common-exit.c
  104. common-init.c
  105. common-init.h
  106. common-main.c
  107. config.c
  108. config.h
  109. config.mak.dev
  110. config.mak.in
  111. config.mak.uname
  112. configure.ac
  113. connect.c
  114. connect.h
  115. connected.c
  116. connected.h
  117. convert.c
  118. convert.h
  119. copy.c
  120. copy.h
  121. COPYING
  122. credential.c
  123. credential.h
  124. csum-file.c
  125. csum-file.h
  126. ctype.c
  127. daemon.c
  128. date.c
  129. date.h
  130. decorate.c
  131. decorate.h
  132. delta-islands.c
  133. delta-islands.h
  134. delta.h
  135. detect-compiler
  136. diagnose.c
  137. diagnose.h
  138. diff-delta.c
  139. diff-lib.c
  140. diff-merges.c
  141. diff-merges.h
  142. diff-no-index.c
  143. diff.c
  144. diff.h
  145. diffcore-break.c
  146. diffcore-delta.c
  147. diffcore-order.c
  148. diffcore-pickaxe.c
  149. diffcore-rename.c
  150. diffcore-rotate.c
  151. diffcore.h
  152. dir-iterator.c
  153. dir-iterator.h
  154. dir.c
  155. dir.h
  156. editor.c
  157. editor.h
  158. entry.c
  159. entry.h
  160. environment.c
  161. environment.h
  162. exec-cmd.c
  163. exec-cmd.h
  164. fetch-negotiator.c
  165. fetch-negotiator.h
  166. fetch-pack.c
  167. fetch-pack.h
  168. fmt-merge-msg.c
  169. fmt-merge-msg.h
  170. for-each-ref.h
  171. fsck.c
  172. fsck.h
  173. fsmonitor--daemon.h
  174. fsmonitor-ipc.c
  175. fsmonitor-ipc.h
  176. fsmonitor-ll.h
  177. fsmonitor-path-utils.h
  178. fsmonitor-settings.c
  179. fsmonitor-settings.h
  180. fsmonitor.c
  181. fsmonitor.h
  182. generate-cmdlist.sh
  183. generate-configlist.sh
  184. generate-hooklist.sh
  185. generate-perl.sh
  186. generate-python.sh
  187. generate-script.sh
  188. gettext.c
  189. gettext.h
  190. git-archimport.perl
  191. GIT-BUILD-OPTIONS.in
  192. git-compat-util.h
  193. git-curl-compat.h
  194. git-cvsexportcommit.perl
  195. git-cvsimport.perl
  196. git-cvsserver.perl
  197. git-difftool--helper.sh
  198. git-filter-branch.sh
  199. git-instaweb.sh
  200. git-merge-octopus.sh
  201. git-merge-one-file.sh
  202. git-merge-resolve.sh
  203. git-mergetool--lib.sh
  204. git-mergetool.sh
  205. git-p4.py
  206. git-quiltimport.sh
  207. git-request-pull.sh
  208. git-send-email.perl
  209. git-sh-i18n.sh
  210. git-sh-setup.sh
  211. git-submodule.sh
  212. git-svn.perl
  213. GIT-VERSION-FILE.in
  214. GIT-VERSION-GEN
  215. git-web--browse.sh
  216. git-zlib.c
  217. git-zlib.h
  218. git.c
  219. git.rc.in
  220. gpg-interface.c
  221. gpg-interface.h
  222. graph.c
  223. graph.h
  224. grep.c
  225. grep.h
  226. hash-lookup.c
  227. hash-lookup.h
  228. hash.c
  229. hash.h
  230. hashmap.c
  231. hashmap.h
  232. help.c
  233. help.h
  234. hex-ll.c
  235. hex-ll.h
  236. hex.c
  237. hex.h
  238. hook.c
  239. hook.h
  240. http-backend.c
  241. http-fetch.c
  242. http-push.c
  243. http-walker.c
  244. http.c
  245. http.h
  246. ident.c
  247. ident.h
  248. imap-send.c
  249. INSTALL
  250. iterator.h
  251. json-writer.c
  252. json-writer.h
  253. khash.h
  254. kwset.c
  255. kwset.h
  256. levenshtein.c
  257. levenshtein.h
  258. LGPL-2.1
  259. line-log.c
  260. line-log.h
  261. line-range.c
  262. line-range.h
  263. linear-assignment.c
  264. linear-assignment.h
  265. list-objects-filter-options.c
  266. list-objects-filter-options.h
  267. list-objects-filter.c
  268. list-objects-filter.h
  269. list-objects.c
  270. list-objects.h
  271. list.h
  272. lockfile.c
  273. lockfile.h
  274. log-tree.c
  275. log-tree.h
  276. loose.c
  277. loose.h
  278. ls-refs.c
  279. ls-refs.h
  280. mailinfo.c
  281. mailinfo.h
  282. mailmap.c
  283. mailmap.h
  284. Makefile
  285. match-trees.c
  286. match-trees.h
  287. mem-pool.c
  288. mem-pool.h
  289. merge-blobs.c
  290. merge-blobs.h
  291. merge-ll.c
  292. merge-ll.h
  293. merge-ort-wrappers.c
  294. merge-ort-wrappers.h
  295. merge-ort.c
  296. merge-ort.h
  297. merge.c
  298. merge.h
  299. mergesort.h
  300. meson.build
  301. meson_options.txt
  302. midx-write.c
  303. midx.c
  304. midx.h
  305. name-hash.c
  306. name-hash.h
  307. notes-cache.c
  308. notes-cache.h
  309. notes-merge.c
  310. notes-merge.h
  311. notes-utils.c
  312. notes-utils.h
  313. notes.c
  314. notes.h
  315. object-file-convert.c
  316. object-file-convert.h
  317. object-file.c
  318. object-file.h
  319. object-name.c
  320. object-name.h
  321. object.c
  322. object.h
  323. odb.c
  324. odb.h
  325. oid-array.c
  326. oid-array.h
  327. oidmap.c
  328. oidmap.h
  329. oidset.c
  330. oidset.h
  331. oidtree.c
  332. oidtree.h
  333. pack-bitmap-write.c
  334. pack-bitmap.c
  335. pack-bitmap.h
  336. pack-check.c
  337. pack-mtimes.c
  338. pack-mtimes.h
  339. pack-objects.c
  340. pack-objects.h
  341. pack-refs.c
  342. pack-refs.h
  343. pack-revindex.c
  344. pack-revindex.h
  345. pack-write.c
  346. pack.h
  347. packfile.c
  348. packfile.h
  349. pager.c
  350. pager.h
  351. parallel-checkout.c
  352. parallel-checkout.h
  353. parse-options-cb.c
  354. parse-options.c
  355. parse-options.h
  356. parse.c
  357. parse.h
  358. patch-delta.c
  359. patch-ids.c
  360. patch-ids.h
  361. path-walk.c
  362. path-walk.h
  363. path.c
  364. path.h
  365. pathspec.c
  366. pathspec.h
  367. pkt-line.c
  368. pkt-line.h
  369. preload-index.c
  370. preload-index.h
  371. pretty.c
  372. pretty.h
  373. prio-queue.c
  374. prio-queue.h
  375. progress.c
  376. progress.h
  377. promisor-remote.c
  378. promisor-remote.h
  379. prompt.c
  380. prompt.h
  381. protocol-caps.c
  382. protocol-caps.h
  383. protocol.c
  384. protocol.h
  385. prune-packed.c
  386. prune-packed.h
  387. pseudo-merge.c
  388. pseudo-merge.h
  389. quote.c
  390. quote.h
  391. range-diff.c
  392. range-diff.h
  393. reachable.c
  394. reachable.h
  395. read-cache-ll.h
  396. read-cache.c
  397. read-cache.h
  398. README.md
  399. rebase-interactive.c
  400. rebase-interactive.h
  401. rebase.c
  402. rebase.h
  403. ref-filter.c
  404. ref-filter.h
  405. reflog-walk.c
  406. reflog-walk.h
  407. reflog.c
  408. reflog.h
  409. refs.c
  410. refs.h
  411. refspec.c
  412. refspec.h
  413. remote-curl.c
  414. remote.c
  415. remote.h
  416. replace-object.c
  417. replace-object.h
  418. repo-settings.c
  419. repo-settings.h
  420. repository.c
  421. repository.h
  422. rerere.c
  423. rerere.h
  424. reset.c
  425. reset.h
  426. resolve-undo.c
  427. resolve-undo.h
  428. revision.c
  429. revision.h
  430. run-command.c
  431. run-command.h
  432. sane-ctype.h
  433. scalar.c
  434. SECURITY.md
  435. send-pack.c
  436. send-pack.h
  437. sequencer.c
  438. sequencer.h
  439. serve.c
  440. serve.h
  441. server-info.c
  442. server-info.h
  443. setup.c
  444. setup.h
  445. sh-i18n--envsubst.c
  446. sha1dc_git.c
  447. sha1dc_git.h
  448. shallow.c
  449. shallow.h
  450. shared.mak
  451. shell.c
  452. shortlog.h
  453. sideband.c
  454. sideband.h
  455. sigchain.c
  456. sigchain.h
  457. simple-ipc.h
  458. sparse-index.c
  459. sparse-index.h
  460. split-index.c
  461. split-index.h
  462. stable-qsort.c
  463. statinfo.c
  464. statinfo.h
  465. strbuf.c
  466. strbuf.h
  467. streaming.c
  468. streaming.h
  469. string-list.c
  470. string-list.h
  471. strmap.c
  472. strmap.h
  473. strvec.c
  474. strvec.h
  475. sub-process.c
  476. sub-process.h
  477. submodule-config.c
  478. submodule-config.h
  479. submodule.c
  480. submodule.h
  481. symlinks.c
  482. symlinks.h
  483. tag.c
  484. tag.h
  485. tar.h
  486. tempfile.c
  487. tempfile.h
  488. thread-utils.c
  489. thread-utils.h
  490. tmp-objdir.c
  491. tmp-objdir.h
  492. trace.c
  493. trace.h
  494. trace2.c
  495. trace2.h
  496. trailer.c
  497. trailer.h
  498. transport-helper.c
  499. transport-internal.h
  500. transport.c
  501. transport.h
  502. tree-diff.c
  503. tree-walk.c
  504. tree-walk.h
  505. tree.c
  506. tree.h
  507. unicode-width.h
  508. unimplemented.sh
  509. unix-socket.c
  510. unix-socket.h
  511. unix-stream-server.c
  512. unix-stream-server.h
  513. unpack-trees.c
  514. unpack-trees.h
  515. upload-pack.c
  516. upload-pack.h
  517. url.c
  518. url.h
  519. urlmatch.c
  520. urlmatch.h
  521. usage.c
  522. userdiff.c
  523. userdiff.h
  524. utf8.c
  525. utf8.h
  526. varint.c
  527. varint.h
  528. version-def.h.in
  529. version.c
  530. version.h
  531. versioncmp.c
  532. versioncmp.h
  533. walker.c
  534. walker.h
  535. wildmatch.c
  536. wildmatch.h
  537. worktree.c
  538. worktree.h
  539. wrapper.c
  540. wrapper.h
  541. write-or-die.c
  542. write-or-die.h
  543. ws.c
  544. ws.h
  545. wt-status.c
  546. wt-status.h
  547. xdiff-interface.c
  548. xdiff-interface.h
README.md

Build status

Git - fast, scalable, distributed revision control system

Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals.

Git is an Open Source project covered by the GNU General Public License version 2 (some parts of it are under different licenses, compatible with the GPLv2). It was originally written by Linus Torvalds with help of a group of hackers around the net.

Please read the file INSTALL for installation instructions.

Many Git online resources are accessible from https://git-scm.com/ including full documentation and Git related tools.

See Documentation/gittutorial.adoc to get started, then see Documentation/giteveryday.adoc for a useful minimum set of commands, and Documentation/git-<commandname>.adoc for documentation of each command. If git has been correctly installed, then the tutorial can also be read with man gittutorial or git help tutorial, and the documentation of each command with man git-<commandname> or git help <commandname>.

CVS users may also want to read Documentation/gitcvs-migration.adoc (man gitcvs-migration or git help cvs-migration if git is installed).

The user discussion and development of Git take place on the Git mailing list -- everyone is welcome to post bug reports, feature requests, comments and patches to git@vger.kernel.org (read Documentation/SubmittingPatches for instructions on patch submission and Documentation/CodingGuidelines).

Those wishing to help with error message, usage and informational message string translations (localization l10) should see po/README.md (a po file is a Portable Object file that holds the translations).

To subscribe to the list, send an email to git+subscribe@vger.kernel.org (see https://subspace.kernel.org/subscribing.html for details). The mailing list archives are available at https://lore.kernel.org/git/, https://marc.info/?l=git and other archival sites.

Issues which are security relevant should be disclosed privately to the Git Security mailing list git-security@googlegroups.com.

The maintainer frequently sends the “What's cooking” reports that list the current status of various development topics to the mailing list. The discussion following them give a good reference for project status, development direction and remaining tasks.

The name “git” was given by Linus Torvalds when he wrote the very first version. He described the tool as “the stupid content tracker” and the name as (depending on your mood):

  • random three-letter combination that is pronounceable, and not actually used by any common UNIX command. The fact that it is a mispronunciation of “get” may or may not be relevant.
  • stupid. contemptible and despicable. simple. Take your pick from the dictionary of slang.
  • “global information tracker”: you're in a good mood, and it actually works for you. Angels sing, and a light suddenly fills the room.
  • “goddamn idiotic truckload of sh*t”: when it breaks