Skip to content

Commit

Permalink
Merge pull request #464 from mmesiti/patch-1
Browse files Browse the repository at this point in the history
under-the-hood.md: correction about commit objects
  • Loading branch information
bast authored Jun 10, 2024
2 parents a319b2d + c28ec68 commit 50ab177
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions content/under-the-hood.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ Git stores everything under the .git folder in your repository. In fact, **the
Previously when you wrote the commit messages using your text editor, they
were in fact saved to `COMMIT_EDITMSG`.

Each commit in Git is stored as a "blob". This blob contains information about
the author and the commit message. The blob references another blob that lists
the files present in the directory at the time and references blobs that record
the state of each file.
Each commit in Git is stored as an object. This object contains information about
the author and the commit message. A *commit object* references a *tree object* that lists
the files present in the directory at the time.
Tree objects reference *blob* objects (that record the state of each file)
or other tree objects.

Commits are referenced by a SHA-1 hash (a 40-character hexadecimal string).

Expand All @@ -62,10 +63,10 @@ Commits are referenced by a SHA-1 hash (a 40-character hexadecimal string).
States of a Git file. Image from the [Pro Git book](https://git-scm.com/book/). License CC BY 3.0.
```

Once you have several commits, each commit blob also links to the hash of the
previous commit. The commits form a [directed acyclic
graph](http://eagain.net/articles/git-for-computer-scientists/) (do not worry
if the term is not familiar).
Once you have several commits, each commit object also links to the hash of the
previous commit(s) (there is more than one previous commit for for merge commits).
The commits form a [directed acyclic graph](http://eagain.net/articles/git-for-computer-scientists/)
(do not worry if the term is not familiar).

```{figure} img/commits-and-parents.png
:alt: A commit and its parents
Expand Down

0 comments on commit 50ab177

Please sign in to comment.