Chapter Six · Branching

Branches

The second big idea after the three places. A branch is a label that moves, which makes creating, switching and merging one obvious. Then the part everyone dreads: a merge conflict, resolved slowly and calmly, with an escape hatch at every step.

5 topics

Branching is the second big idea in this book, after the three places. It is also the one that beginners avoid longest, usually because it sounds like it involves copying the project and they are not sure they could undo it.

It does not involve copying anything. A branch is a label that moves, and once that sentence is properly in place, creating one, switching between them and merging them back all become obvious rather than mysterious.

Five topics. What a branch actually is. Making one and switching between them, which is the moment your files visibly change in front of you. Merging the work back, where the rule is about which branch you are standing on. Then the page everyone dreads: a merge conflict, taken slowly, with an escape hatch at every step. And finally cleaning up, so the project stays navigable.

Everything here is local. Nobody else is involved yet, which makes this the safest possible place to practise the operations that Chapter 8 will do with somebody waiting.

The loop this chapter builds, start to finish
Branchgit switch -c
Commitas usual
Mergeinto main
Deletethe label only

Topics in This Chapter