Realcodeart.com

Git

Ten days in April 2005, after the old license disappeared.

Linus Torvalds, 2005

Get it on a mug or tee →

The Linux kernel had been using BitKeeper to move patches. BitKeeper was a proprietary tool with a no-cost license for kernel work, a compromise that let a free project depend on a closed one. In 2005 the compromise ended. A dispute over a client that spoke the protocol without the company's blessing led the company to withdraw the arrangement. The kernel still needed a way to take patches from hundreds of people and keep a history. Linus Torvalds stopped waiting and wrote a replacement.

He did it quickly. The lede on this page says ten days in April 2005, and the public record of those days supports the speed if not the comfort. The early README calls the result the information manager from hell. The name Git has been given several folk etymologies since, none of which improve the tool. The tool was for patches and for speed. Comfort was a layer other people would add, and did add, once the storage was trustworthy.

The design is content-addressed. A file's contents are hashed, and the hash is the name. A tree is a list of those names. A commit is a tree plus the parents plus a message. Change one byte and the name changes. History is a graph of those names, and a repository is a bag of objects plus the refs that point at the interesting tips. The early versions used SHA-1 for the hash. The point was not the particular function. The point was that a name you could recompute was a name nobody had to assign. Integrity came from the mathematics, and distribution came from the fact that two people with the same objects had the same history, whether or not they shared a server.

The bars are main in update-cache.c from the first commit. The program reads the cache, locks an index file, .dircache/index.lock, and adds the paths you named. This is plumbing. There is no git add yet as a polite command. There is a program that updates a cache, because that was the operation Torvalds needed in order to record a tree. Later Git renamed the commands and grew a porcelain, the surface people type. Junio Hamano took over maintenance and kept the surface stable enough to become infrastructure. The first commit remains the picture, because the first commit is when the idea was still the size of a few files.

Git is GPL-2.0 only, the same family of license as the kernel it was born to serve, with the same refusal to float forward onto a later version. A lawyer cleared this listing. The license notice stays on the product page, not on the mug. As with the kernel, the reason is physical and legal at once. The license is a text that must accompany the work. A cup of colored bars is not an accompaniment. The page is.

What the bars show, if you know the excerpt, is a command-line program of the old shape. Arguments come in. A lock is taken so two updates cannot corrupt the index. Paths are added. The lock is the interesting line for anyone who has lost work to a crash. Even the information manager from hell did not trust itself with an unlocked file. The gray bars, if the excerpt has comments, are the notes. The colored bars are the calls. None of them spell the README's joke. The joke stays in this essay, where the first commit already put it, and where a history is allowed to use words.

The speed of those ten days is the part gift buyers remember, and it is the part programmers should not romanticize into a method. Torvalds already knew the kernel's workflow, the patch culture, and the failure he would not accept, which was a single machine as the source of truth. The tool fell out of that knowledge. The mug does not show the knowledge. It shows main, the lock, and the paths. The page shows the license, the year, and the reason the old tool had to be left behind.

Porcelain is what most people mean when they say they know Git. The first commit did not have it. Remembering that saves a person from thinking the friendly commands are the invention. The invention was the objects, the lock, and the refusal to keep history on one computer. The friendly commands are how the invention survived contact with everyone else.

Mug and tee of Git