← Back to all publications

Git Internals Explained: How Commits, Trees, and Blobs Function Under the Hood

Demystifying the plumbing of Git. How content-addressable storage, SHA hashing, and Directed Acyclic Graphs power everyday version control.

COMMIT (4b825dc) parent: a3190bf tree → 7c9412a author: HB <hb@hb4.space> TREE (7c9412a) 100644 blob → index.ts 100644 blob → style.css File mode & hash mapping BLOB (d5e1f0) Raw source code bytes BLOB (88a912) Raw style sheet bytes Cryptographic Content-Addressable Key-Value Storage Objects referenced purely by SHA hashes • Commits form an immutable Directed Acyclic Graph

Git is a Content-Addressable Key-Value Store

Most developers perceive Git as a tracker of file differences (deltas). In reality, Git is an elegant content-addressable storage system with a VCS interface layered on top. At the core of the .git/objects directory are four primitive object types:

  1. Blob: Raw file data without file names, timestamps, or directory paths.
  2. Tree: Represents a directory listing, mapping file names and permissions to child blob or tree hashes.
  3. Commit: Points to a top-level tree hash, contains author metadata, commit timestamp, commit message, and parent commit hash(es).
  4. Annotated Tag: A permanent reference pointing directly to a specific commit object.

The Directed Acyclic Graph (DAG)

Because each commit records the exact cryptographic hash of its parent commit, the entire history forms an immutable Directed Acyclic Graph. Commands like git branch or git tag do not copy files—they simply create lightweight 41-byte text pointers referencing a commit SHA.

# Inspect raw object contents directly
git cat-file -p HEAD
# Outputs:
# tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
# author HB <hb@hb4.space> 1727800000 +0000
# committer HB <hb@hb4.space> 1727800000 +0000
# 
# feat: initialize clean edge architecture
HB

Written by HB

Writing on systems programming, backend architectures, and modern web engineering.

Continue Reading

Cloud Infrastructure

Architecting Distributed State at the Edge with Durable Objects

2026-09-01 • 7 min read
TypeScript

Mastering TypeScript Generics: Patterns for Robust, Type-Safe Systems

2026-09-05 • 6 min read