Building GitJames Coglan
Building Git
by James Coglan · first published 2021
29mentions
19recommended by
23HN commenters
2019–2026first – last mentioned
83% recommend17% neutral
Why HN recommends it
Thorough walkthrough of reimplementing Git from scratch in Ruby, covering index, commits, and status. Readers learn Git internals in depth and port it to Go, Python, or Rust; suits those who want a challenge.
Summarised by Claude from recommending comments
Affiliate links. As an Amazon Associate I earn from qualifying purchases.






Spend the summer reading "Building Git" by James Coglan. Why? - You'll learn Ruby, a new language - You'll understand Git at a pretty advanced level - You'll get exposure to testing - You'll get exposure to unix programming The book is…
on “Ask HN: What skills as a CS student should I focus on this summer?” ↗I worked partway through this book called "Building Git" by James Coglan, a few years ago, which beautifully expanded on the internal structure of git. Anyone interested should definitely check it out. It is definitely much more accessible than suffering through…
on “Understanding Git: The History and Internals” ↗Does nobody on this forum read technical books anymore? I read building git by James Coglan, and it was pretty good.
on “Ask HN: What is the best thing you read in 2024?” ↗There is also James Coglan's "Building git" book that I just went through and can vouch for its quality.
on “Artisanal handcrafted Git repositories” ↗This is a Python port of the git(1) clone that can be found in James Coglan's amazing book, "Building git". I've definitely had a blast putting it together, and I also learned a lot, both about git and about Python. I highly recommend the book if you're up for a challenge. I'd say it's in the same ballpark…
on “Show HN: A Git(1) implementation written in Python” ↗…https://www.packtpub.com/web-development/building-enterprise-javascript-applications Which takes the reader from zero to building a non-trivial production fullstack application with JavaScript. I also recommend "Building Git". The title is self-explanatory: https://shop.jcoglan.com/building-git/ Other resources: https://github.com/AlgoryL/Projects-from-Scratch https://github.com/tuvtran/project-based-learning
on “Ask HN: What are some books where the reader learns by building projects?” ↗If you're interested in a step-by-step guide on how to build your own git from scratch, this book is excellent and incredibly educational: https://shop.jcoglan.com/building-git/
on “Gitoxide: Pure Rust Implementation of Git” ↗Looks neat! This reminds me heavily of the excellent Building Git by James Coglan[1]. From a cursory glance though, it doesn't seem to support reading packfiles. This was the big thing that prevented me from using a fully custom Git implementation when I wrote my git churn calculator[2]. For larger repositories, it seems that almost all files are stored in packfiles, rather than the conceptually
on “Show HN: ugit – Learn Git Internals by Building Git in Python” ↗This is great and really useful to me! I am also, like others here, in the process of writing my first "book": https://redis.pjam.me/. Mainly inspired by https://shop.jcoglan.com/building-git/, rebuilding Redis, instead of git, in Ruby. > For my first few sections I wrote the code as I wrote the sections, but then Lak made the suggestion that it would probably be easier to write the code first an
on “Writing a technical book: from idea to print” ↗If you're interested in this, you may enjoy "Building Git" by James Coglan - a comprehensive book that takes you through reimplementing git in Ruby. https://shop.jcoglan.com/building-git/
on “Git implemented in Rust” ↗…the video but I've gone through that guide you linked, it's excellent but I don't think it's a great comparison. It only implements a handful of commands and doesn't go into the same amount detail. The Building Git book goes way more into the interesting bits.
on “Gitoxide: Pure Rust Implementation of Git” ↗Folks interested in this may also be interested in a new book from James Coglan "Building Git": https://shop.jcoglan.com/building-git/ It also takes a ground-up "build it yourself" approach and has tons of interesting detail.
on “Write yourself a Git (2018)” ↗I'm hoping that finishing the excellent https://shop.jcoglan.com/building-git/ will give me enough git-fu to start making some modest contributions.
on “The struggles of an open source maintainer” ↗Looks as good as "Building Git", which I'm currently enjoying. https://shop.jcoglan.com/building-git/ If it will get me over the monad hump with Haskell, all the better.
on “A Type of Programming” ↗For anyone wanting to understand Git from inside out at a fundamental level, I can't recommend the 'Building Git' book enough. The code is Ruby, but there's enough explanation for each snippet to be able to follow along in whatever language one prefers. I had no problems with translating to Go, for example. 1 - https://shop.jcoglan.com/building-git
on “Shit – An implementation of Git using POSIX shell” ↗