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 words13 out · 14 in
also calledMerge queue

A merge train — or merge queue — serializes 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 also12

Stacked Pull Requests

A chain of dependent changes, each reviewed separately and merged in order.

Version Control & Delivery12 connections

Three-Way Merge

Combining two lines of work by comparing both against their common ancestor.

Version Control & Delivery17 connections

Trunk-Based Development

Everyone integrating into one shared branch continuously, with short-lived feature branches.

Version Control & Delivery20 connections

Branching Model

The convention governing what branches exist, what they mean, and how work reaches production.

Version Control & Delivery18 connections

Rebase

Replaying a branch's commits onto a new base, producing new commits with the same changes.

Version Control & Delivery19 connections

Merge Conflict

Overlapping changes that a merge cannot combine automatically, requiring a decision.

Version Control & Delivery17 connections

Continuous Integration

Automatically building and testing every change, so integration problems surface immediately.

Version Control & Delivery38 connections

Pull Request

A proposal to merge a branch, carrying review, automated checks, and the discussion around it.

Version Control & Delivery25 connections

Feature Branch

A branch created to develop one change in isolation before merging it back, a workflow that keeps the main line stable but grows riskier the longer the branch lives, since its divergence from everyone else's work compounds.

Version Control & Delivery16 connections

Release Train

Shipping on a fixed schedule whether or not a given feature is ready, so features that miss one release simply wait for the next instead of holding everyone back.

Version Control & Delivery13 connections

Branch Protection

Server-side rules that stop people from pushing straight to important branches, requiring reviews, passing checks, and intact history instead.

Version Control & Delivery13 connections

Fast-Forward Merge

The two basic ways Git joins branches, by sliding a branch pointer forward or by recording a new commit with two parents, and how the choice shapes a project's history.

Version Control & Delivery14 connections

Linked from14