Git Made Crystal Clear · chapter 5: Branching and Merging Without Fear

Branches on the commit DAG

2026-10-14

Each commit points back to its parent; main and feature are movable pointers, HEAD marks the current branch, and merge commit M has two parents.

Below: the paragraph from the book that builds this idea, then the diagram itself (Figure 5.1), and a recap. About a minute of reading.

HEAD is the pointer that says which branch you are on right now. When you commit, the current branch pointer moves forward to the new commit, and HEAD moves along with it. Because commits link back to their parents, the history forms a directed acyclic graph (DAG): each commit points to its parent, and a merge commit points to two parents.

Figure 5.1: Branches on the commit DAG. Each commit points back to its parent; main and feature are movable pointers, HEAD marks the current branch, and merge commit M has two parents.
Figure 5.1: Branches on the commit DAG. Each commit points back to its parent; main and feature are movable pointers, HEAD marks the current branch, and merge commit M has two parents.

Recap

  • The idea: Each commit points back to its parent; main and feature are movable pointers, HEAD marks the current branch, and merge commit M has two parents.
  • The picture: Figure 5.1, from chapter 5 ("Branching and Merging Without Fear") of Git Made Crystal Clear.
  • Go deeper: the chapter builds this step by step, with recipes and sources at the end.

This diagram is one of many in Git Made Crystal Clear.

Every chapter opens with the gist, draws the hard ideas, and ends with recipes and sources.

Get the book

All diagrams