Tiny Git

Tiny Git (tiny-git on the command line, tinygit as a Python package) is a content-addressed version-control system written in Python 3.10 to 3.13 without calling git underneath.

I wrote it small enough that someone curious about how Git works can read the whole codebase in an afternoon. It covers SHA-1 object storage with atomic temp-file writes, tiny-git fsck verification, a binary staging index, commits, branches, a HEAD reflog, checkout checks that refuse to overwrite uncommitted edits, unified diffs, and three-way merges using lowest common ancestor traversal.

Read Reading and writing Git internals in an afternoon or check the code on GitHub.


Linked mentions