I’m working my way through James Cogland’s Building Git and it’s a delightful read.
Git and its role in building software is fertile grounds for exploring the social interactions of the software industry. Git’s history, in brief, is the Linux Kernel project started using a version control system (named BitKeeper) that turned out to be less open source than folks wanted, so the Linux project built their own version control system named git that incorporated many of the concepts they liked from BitKeeper and released git as open source software, and then lots of other people started using git and said “yes, but it’s hard to use” and the git maintainers said “shrug/lolz”, and then a venture backed startup created a web application and support structure for the git program called GitHub (a web application and support structure that was mostly separate from the git project) and sold themselves to Microsoft for seven and a half billion dollars in stock.
So many vectors of exploration there. James’s book, although it’s a book for practitioners, ends up being an exploration of the “shrug/lolz” problem.
Git is implemented in the C programming language. C is a language where the code ends up being more about managing your computer’s memory and the lack of type safety in C than whatever your program is trying to do. It’s hard to sit down with a C program and quickly understand the problem it’s trying to solve. (This, by the way, is why I think C programmers are so insufferable about how people write code — but that’s another blog post)
Git also stores all your files on disk in a database-ish structure that’s 100% custom to git and equally difficult to understand just by sitting down and looking at it.
If you’re a heavy git user there’s probably a phrase you’ve either said or heard — that to use git well you really need to understand how it’s implemented. There’s a truth to this statement — but given the challenges outlined above where’s a reasonably bright and motivated person supposed to learn this without making git their full time job?
That’s the problem Building Git sets out to solve — and along the way you’ll end up learning a whole lot about unix programming. Rather than just tell you about Git’s internals, Building Git walks you through creating your own git client using the ruby programming language. You’ll write code that initializes a repository, makes commits to git’s internal object store, branch, merge, etc. Along the way you’ll end up learning what all those files in
.git are for, and be tremendously better positioned the next time you’re staring at a complicated merge or rebase that could wreck your team’s day.
Building Git is the rare book that teaches you a deep technical concept while still talking to you like a human being. If you’ve ever been frustrated by git and wished you knew what was happening down there in the dark corners of your
.git folder, this is the book for you.