01
Branches
The branch as pointer and how cheap branching is, adapting the workspace through branch creation and switching, a readable naming convention within a team, and how detached HEAD arises and how to get out of it.
- 01 The Concept of a Branch A branch is a pointer: in a twelve-commit setup, opening three branches writes zero new commits and 123 bytes of reference, and while the copy model copies twelve thousand files for the same tree at four thousand files, the pointer model's cost stays constant.
- 02 Branch Creation and Switching Opening a branch and switching to it are separate operations: the switch only rewrites files that differ between the two branches, and of the twelve remaining-change cases, 3 move along, 5 block the switch, 4 are left behind; none is silently lost.
- 03 Branch Naming A branch naming convention adds to history's first question what the branch record alone cannot: of the eight combinations of two integration formats and four naming conventions, the group is actually readable in only 3, because keeping a record and having a readable name are two separate conditions.
- 04 Detached HEAD State When two commits made on a detached HEAD are reachable from no reference, history drops from 15 records to 13 and answers 4 of the six questions instead of 5; the real cost is that all three counting queries are answered incompletely, and history does not report it.