Kelly Mears

Merge Train

Validating changes against the state they will actually merge into, in order, rather than in isolation.

Version Control & Delivery2 min read205 words9 out · 9 in
also calledMerge queue

A merge train — or merge queue — serialises pending changes and validates each against the result of merging every change ahead of it. It exists because a change validated in isolation is validated against a state that will not exist by the time it lands.

The problem it solves is the Semantic Conflict: two changes that are each entirely green and combine into something broken, with no textual conflict anywhere. Nothing about either change can reveal this. Only the combination can.

The manual equivalent, when landing a batch of ready changes at once, is to merge every one into a scratch working copy first, resolve there, and run the full validation once on the union. It is dramatically cheaper than discovering the same information from a broken main branch, and it also catches the mundane version — two changes each editing a shared string, one adding an assertion naming the old value.

Two operational notes. Branch protection settings that appear to enforce up-to-dateness are frequently inert in practice, so non-conflicting changes land back to back with no validation between them; test the assumption rather than relying on it. And rapid successive merges supersede each other's queued validation runs, so only the last one reports.

See also6

Hand-picked in the note itself — the neighbours worth reading next.

Related3

Nearby in the graph rather than deliberately chosen. Looser, sometimes surprising.

Linked from9

Notes elsewhere in the wiki that reach for this one.