Gitlet
Systems / Spring 2022
Git clone with commits, branches, merging, and persistent storage.
- Java
- JUnit
- Data Structures
Overview
A Git implementation from scratch in Java for Berkeley's CS 61B. Supports init, add, commit, checkout, branch, merge, and persistent object storage.
System design
SHA-1 content addressing for blob and commit deduplication - the same file content always produces the same hash, so identical files are stored once regardless of how many commits reference them.
Persistent storage serializes the entire object graph to a .gitlet directory. Commits form a DAG, branches are just pointers to commit nodes, and checkout reconstructs the working directory from the stored blob tree.