Merge Queue
Enterprise scale merge queue to merge pull requests quickly while protecting your main branch.
Trunk Merge Queue is a hosted merge queue service. It manages and controls the order in which enqueued pull requests are merged into the main
branch of your repository. Trunk Merge Queue enables large teams working in a monorepo to reduce merge conflicts and maintain a green, healthy main branch.
Why use a merge queue?
Merge queues automate PR merges into your repo's main
branch, ensuring incompatible changes never break the branch. They are a best practice for trunk-based development in repos with 10-1000+ active engineers.
Why do teams adopt a merge queue?
As the number of concurrent, changes to a repository grows, the likelihood that your pull request has stale/invalid test results increases. The only way to guarantee that your main
branch doesn not become "broken" is to make sure that all code changes are tested against the head of main
.
As an example:
Jack opens pull request A which renames the function
foo()
tobar()
and updates all the call sites to the new name.Jill opens pull request B which adds a new file that uses the existing function
foo().
Jack and Jill are not aware of each other's PRs, and the automated build and tests for each of these independent pull requests both pass.
Regardless of order, when pull requests A and B both merge, there is code in the system calling the function
foo()
that no longer exists.The build is now broken.
A merge queue's purpose is to give you the guarantee of all code being tested against main
without actually doing that work serially or in reaction to code merging onto main. The merge queue service predicts the future state of main
and tests against that. (see predictive testing). Returning to our example - pull requests A and B would both be submitted to the merge queue, which would then perform the predictive testing to ensure that A and B, when combined, do not break the build.
What is unique about Trunk Merge Queue?
Batching
Dynamic Parallel Queues
Optimistic Merging
Pending Failure Depth
Prioritization
Flaky Test Protection
Requirements
Trunk Merge Queue works with any CI provider as long as you use GitHub for your repo hosting.
Next Steps
Last updated