Basis Lab

How a program runs

Derive version control from one idea, which is naming things by their contents, so that every command becomes an obvious operation on a graph of snapshots and recovering from a frightening mistake stops being a matter of luck

How a Repository Remembers

Version control rebuilt from content addressed storage, where commits are snapshots, branches are labels, and nothing is lost until it is collected.

8 lessons, written and corrected before you arrived. Reading them here needs no account. The first reads the whole way through; the others open and then stop, because a page nobody owns cannot tell who is reading it. Starting the course gives you your own copy, where every idea has problems standing under it and you can ask about any sentence.

Start reading

  1. 01What a Git Hash Is Actually a Hash OfHashing a file's bytes gives the wrong answer. A type word, a byte count and a zero byte go in first, and three rules about repositories fall straight out of that.
  2. 02Why a Commit Is a Whole Snapshot and Still Costs Almost Nothingopening onlyA commit records every file in the project, not your edits. Here is the arithmetic that turns 800 MB of apparent snapshots into under 9 MB of real storage.
  3. 03Every Commit Names Its Parent, and a Branch Is One Line in a Fileopening onlyA commit holds its parent's name inside the bytes that give the commit its own name, which makes history a graph, a branch a 41 byte file, and a rewrite unavoidably a set of new commits.
  4. 04Why the Same File Is Reported as Both Staged and Not Stagedopening onlyOne path can hold three different versions at once, and the two letters in a status line are two independent comparisons between them rather than one verdict on the file.
  5. 05Why a Merge Only Stops to Ask About Some of Your Changesopening onlyA merge reads three versions of every file, not two, and the third one is the commit both lines came from. That reading decides what it can apply for you.
  6. 06Why Your Commits Get New Names When You Rebaseopening onlyA commit's name is computed over its parent as much as over its files, so replaying history cannot edit a commit. It writes a new one and leaves the old one behind.
  7. 07A Hard Reset Deletes Nothing, and You Have About Thirty Daysopening onlyA reset moves a label and leaves every commit exactly where it was. Here is the local record that still names them, how to point a label back, and the real window before collection.
  8. 08Why Your Push Was Rejected, and the One Push That Destroys Workopening onlyA second copy is another object store with the same names and different labels, which makes a transfer a set difference and a rejection a refusal to drop a commit.