Skip to content

Build Your Own Git

Build a working subset of git from scratch — content-addressable object storage, trees and commits, refs and HEAD, the index, checkout planning, line diffs, and three-way merges. By the end you'll deeply understand Linus's elegant design and exactly what `git add`, `git commit`, `git checkout`, and `git merge` do under the hood.

intermediate18 lessons4 chapters18 graded exercisesPython

No sign-up needed for lesson 1 · certificate on completion · sign up to save progress

What you’ll have built

Chapter by chapter. Every step is a graded exercise.

  • Object Storage
  • Trees & Commits
  • Refs & History
  • Branching, Diff & Merge
Starts in Python — solve in the language you choose in the editor, same tests either way.

Curriculum

4 chapters, 18 lessons. Each lesson is a short read, one graded exercise, and a quiz.

  1. 1hash-object: How Git Identifies ContentRead · exercise · quiz
  2. 2Object Format: Inspecting Raw ObjectsRead · exercise · quiz
  3. 3Compressed On-Disk StorageRead · exercise · quiz
  4. 4Packfiles: How Real Git Stores Millions of ObjectsRead · exercise · quiz
  5. 5cat-file: The Object-Store Swiss Army KnifeRead · exercise · quiz
  6. 6Packfile Header: Reading the BytesRead · exercise · quiz
Loading reference solution…
Build Your Own Git