If you already use a separate, external merge queue offering, Graphite can integrate with that merge queue, reducing the manual work required to merge stacks of PRs.

Graphite’s integration will:

  • Merge PRs one-by-one by enqueueing them in your merge queue

  • Automatically rebase PRs before adding them to the merge queue, as necessary

This offers a quick and seamless way to onboard your team to Graphite when you’re already using an external merge queue.

Limitations

Unlike Graphite’s merge queue, external merge queues don’t use stack context to optimize merges, so you won’t benefit from the same performance boosts and guarantees available with theGraphite merge queue.

In particular, with external merge queues Graphite can only merge PRs one at a time: for a stack of PRs ABC, where A is the base PR

  • A will be added to the queue

  • Only when A is successfully merged will Graphite rebase B and then add B to the queue

  • Repeat for C

GitHub merge queue

Enable the external merge queue integration

Go toMerge queuein the Graphite app settings page (https://app.graphite.dev/settings/merge-queue), and:

1

Click Add merge queue

2

Select the repository you want to enable it for by using the dropdown selector

3

Select External merge queue integration as the merge queue type

4

Click Next

5

Select Enable adding to GitHub merge queue and save your merge queue settings

To merge, click the Merge when ready toggle in the top right of the PR page.

When a PR is the first open PR in the stack and has Merge when ready active, Graphite will then add the PR to your GitHub merge queue.

Other merge queues

If you use a merge queue outside of the Graphite or GitHub merge queues, Graphite can be configured to add PR to your queue by applying a custom label to the PR.

Note: if you merge PRs with your merge queue another way, such as running CLI commands or calling an API, Graphite won’t be able to merge your PRs for you.

Enable the external merge queue integration

Go toMerge queuein the Graphite app settings page (https://app.graphite.dev/settings/merge-queue), and:

1

Click Add merge queue

2

Select the repository you want to enable it for by using the dropdown selector

3

Select External merge queue integration as the merge queue type

4

Click Next to specify your merge label and save your merge queue settings

Merging via your merge queue

Once you’ve completed the configuration steps above, PRs created in that repo can now be merged via your merge queue.

  • For single PRs, and base PRs in a stack: the merge button is replaced with an “Apply merge label” button that immediately applies the merge label

  • For upstack PRs: the merge button is replaced with an “Apply merge label when ready” button that acts as follows: for a stack of PRs ABC, where A is the base PR:

    • A immediately receives your repo’s merge label, handing off merging to your merge queue

    • When A is successfully merged, Graphite rebases B, and upon succeeding applies your repo’s merge label. If the rebase fails, Graphite informs the author as usual.

    • It repeats the process for B, and so forth for larger stacks.

During the merge process, the PR status for each PR will communicate if the PR is actively waiting on downstack merges, or if the merge has been handed off to your merge queue.

(Optional) Updating your PR inbox

Enqueued PRs

To track enqueued PRs in your PR inbox, you can create a section with the following settings:

Blocked PRs

Many merge queues represent merge failures by adding a label denoting that the PR is blocked. You can create a section to track these with the following settings:

Troubleshooting

  • PRs getting evicted while enqueued: once you mark as a stack as ready to merge, re-stacking those PRs when they’re already in your merge queue may result in your merge queue evicting them due to making changes. You may want to avoid re-stacking a PR while your merge queue is processing it.

  • Handling failed merges: your merge queue may take actions like adding a “blocked” label on PRs that failed to merge. To re-enqueue after fixing the issues, manually remove the custom label.