Gitlet — A Miniature Git
Built a working version-control system in Java from scratch — init / add / commit / log / checkout / branch / merge — modeled on git's internals. CS 61B Project 3.
Overview
The signature CS 61B project. Three weeks to reproduce the core of git: content-addressed storage, the commit DAG, branch pointers, and a three-way merge with lowest common ancestor. Forced me to think about why git's design choices make sense before I could implement them.
Process
- 01
Object model
Designed the blob / tree / commit object graph. SHA-1 content hashes for addressing, Java serialization for persistence. This is where I first felt the difference between data structures and a system.
- 02
Core commands
Implemented init, add, commit, rm, log, global-log, find, status, checkout, branch, rm-branch, reset. Each command has edge cases that break naïve implementations — handling them is the whole point of the assignment.
- 03
Merge & conflict resolution
Built the three-way merge algorithm: find the split point via LCA, compare three files, apply git's specific conflict rules. The spec is surprisingly strict; passing the merge autograder was the most satisfying moment of the semester.
Result
~3,000 lines of Java. Passed the autograder with a high mark. The project shifted how I read all future codebases — I now think in terms of what's the data model, what operations are idempotent, where does state get mutated. Gitlet is the reason systems make sense to me.
By the numbers
~3K
Lines of Java
High pass
Autograder
3 weeks
Duration
Next project
Zhihu College-Topics Scraper
Distributed scraper for 500+ college-related Zhihu topics — 1M+ comments and questions — with sentiment analysis and topic modeling. Built under Berkeley URAP.