Merge Queues

Avoiding conflicts and keeping trunk green.

What is a merge queue?

A merge queue is a tool that tries to automatically maintain a repository of code that always passes tests. Merge queues accomplish this by validating code changes in a stable order before merging them into a trunk branch. By enforcing a pre-merge order, merge queues eliminate skew and reduce semantic conflicts. Without the help of some merge queue, semantic conflicts break trunk branches in repositories more and more frequently as the repositories scale. At a high enough rate of committers, it becomes practically impossible to “keep trunk green” without a merge queue.

Most merge queues intercept the traditional big green “merge” button on PRs and replace it with some “enqueue” action. From there, the merge queue re-executes CI tests, with each change rebased in order. As code changes in the queue pass the order-enforced testing, they're automatically merged into the desired trunk branch.

Merge queues effectively ensure that CI still passes at the moment of merge regardless of how long the PR has been open. However, some engineers dislike anything that slows down the time to merge - and even the most advanced merge queues will create some slowdown while CI runs. This cost is a necessary evil as the number of committers scales, but it can be mitigated. Teams that care about speed should leverage features such as batching, parallel CI, and partitioning to keep changes merging as fast as possible. Most modern merge queue solutions offer some set of these features.

Popular off-the-shelf merge queues

A full featured merge queue solution with an advanced GUI, support for parallel CI and batching, and a built in dashboard for managing many queues across an org. The only merge queue which supports stacked PRs.
One of the oldest paid merge queue solutions. Very full-featured, with a focus on configuration as code.
The original open-source merge queue solution, which later inspired other tools. Simple, but gets the job done. Tried and tested.
A merge queue with a focus on dynamic queue partitions within the same repository through build system integrations.
Relatively similar to Mergify, with more focus on UI based merge-queue configuration. Subtle design details inspired from Google's internal tools.
GitHub Merge Queue
The most integrated merge queue solution, great for teams who need a no-frills native tool. A lack of advanced features makes it less suitable for large teams.