Commit graph (source code)

= Commit graph

A <commit graph> represents <version-control commits> as vertices and their parent relationships as directed edges. In <Git (version control)>, taking an edge from a child to each parent gives a <directed acyclic graph>: an existing <version-control commit> has fixed parents, and a newly created child cannot become its own ancestor.<Pro Git by Scott Chacon and Ben Straub>[§10.2, commit objects and parent references]{ref}

For example, if $B$ and $C$ both descend directly from $A$, and merge $M$ records parents $B,C$, its edges are $M\to B$, $M\to C$, $B\to A$ and $C\to A$. The merge retains both lines of ancestry. A <version-control branch> labels a selected tip; deleting that label does not by itself remove every reachable vertex. This graph supports ancestry tests and finding common bases for <version-control merging>.