Git Internals

Merge Bases and Ancestry

Explain how Git uses common ancestors to reason about branch differences, merge inputs, and reachability.

The short version

Explain how Git uses common ancestors to reason about branch differences, merge inputs, and reachability.

Key ideas

  • The common ancestor defines the comparison starting point
  • merge-base directly shapes merge and rebase decisions
  • Reachability underlies many Git queries

Why this helps you understand commands

Many command differences that feel arbitrary become easier once you see how Git is updating objects, refs, the index, or reachability.

Suggested follow-up

It pairs well with git show, git log --graph, git cat-file, git rev-parse, or git fetch.