How we built the first stack-aware merge queue (and why it matters)
9/1/2025 10:46pm
**Graphite's Solution to the Merge Queue Paradox**
1. **Understanding the Merge Queue Paradox**: In fast-moving engineering teams, breaking work into smaller pull requests and hiring more engineers can lead to a bottleneck in the merge process. Traditional merge queues, like those found in GitHub, Mergify, or Bors, can slow down merge times significantly when dealing with stacked development, where pull requests are dependent on each other.
2. **The Need for a Stack-Aware Merge Queue**: Graphite recognized this bottleneck and developed the first stack-aware merge queue to address the inefficiencies caused by traditional merge queues. This new merge queue understands the dependency graph of stacked pull requests, allowing for more efficient and faster merges.
3. **Technical Innovations**: Graphite's merge queue introduces a temporary branch with a prefix like `main/pr-2` that contains code changes from the target branch, previous pull requests, and dispatches webhooks. This innovation ensures that the pull request's changes pass all required status checks when applied to the latest version of the target branch.
4. **Impact on Engineering Teams**: The implementation of Graphite's stack-aware merge queue has shown significant improvements. For example, at Ramp, merge times are 74% faster, and at Asana, engineers save 7 hours per week per developer. Additionally, code shipping increases by 21%.
5. **Wider Adoption**: The merge queue is now available to every engineering team, offering a solution to the merge queue paradox and the inefficiencies of traditional merge queues when dealing with stacked development.
In conclusion, Graphite's first stack-aware merge queue is a critical innovation for engineering teams dealing with stacked development, offering substantial improvements in merge times and developer productivity.