Git, Visualized to the Metal — Episode 3: Trees and Commits (How Git Remembers Filenames)

Опубликовано: 23 Июль 2026
на канале: The Stack Underflow
28
0

Last episode we opened a blob — pure content, no filename. This episode
we open the object that gives blobs their names.
Episode 3 — Trees and Commits. Git's storage is three object types, not
one. Blobs hold content. Trees map filenames to blobs. Commits wrap
trees in history. In this episode we make a commit, watch new folders
appear in .git/objects/, identify each one with git cat-file -t, and
open them with git cat-file -p. The payoff: two filenames pointing to
the same blob — proof that the deduplication from Episode 2 is what
makes the whole system work.

What you'll learn:
What happens to .git/objects/ when you run git commit
How git cat-file -t identifies object types
What a tree object actually contains (mode, type, hash, filename)
Why two filenames can point to the same blob — and what that means
What a commit object contains (tree, parent, author, message)
How parent pointers form Git's history as a linked list of trees
The complete mental model: commit → tree → blobs

This is Episode 3 of an ongoing series. Episode 4 cracks open subtrees —
the way Git handles nested directories. Subscribe so you don't miss it.

⏱ Chapters
00:00 - The Question Returns
00:51 - Making a Commit
01:51 - Inside a Tree
03:03 - Inside a Commit — Git Objects Explained
04:04 - The Full Graph

🔗 Previous episodes:
Episode 1 — The Three States:    • Git, Visualized to the Metal — Episode 1: ...  
Episode 2 — The Object Database:    • Git, Visualized to the Metal — Episode 2: ...  



Subscribe: @TheStackUnderflow

#Git #GitInternals #GitTutorial #GitObjects #VersionControl
#SoftwareEngineering #LinuxInternals #DeveloperTools #LearnToCode