wit merge-queue command provides automated merge queue management for pull requests. The merge queue ensures PRs are tested against the latest base branch before merging, preventing broken builds.
Overview
Why Use a Merge Queue?
Without a merge queue, this can happen:- PR #1 passes CI on
mainat commit A - PR #2 passes CI on
mainat commit A - PR #1 merges,
mainis now at commit B - PR #2 merges without retesting against B
mainis now broken because #2 conflicts with #1’s changes
- PRs are queued for merging
- Each PR is rebased on the latest
mainand tested - Only PRs that pass against the current
mainare merged - Your main branch stays green
Commands
add
Add a pull request to the merge queue.Options
| Option | Description |
|---|---|
-b, --branch <branch> | Target branch (default: main) |
-p, --priority <0-100> | Priority level (higher = more urgent) |
Examples
This command requires the server-side merge queue API to be implemented.
remove
Remove a pull request from the merge queue.Examples
status
Check the queue position and status of a pull request.Examples
Example Output
list
List all pull requests in the merge queue.Options
| Option | Description |
|---|---|
-b, --branch <branch> | Filter by target branch |
--json | Output in JSON format |
Examples
Example Output
stats
Show merge queue statistics.Options
| Option | Description |
|---|---|
--json | Output in JSON format |
Example Output
config
View or update merge queue configuration.Options
| Option | Description |
|---|---|
--strategy <type> | Merge strategy: sequential, parallel, adaptive |
--batch-size <n> | Max PRs to test together (for parallel/adaptive) |
--timeout <minutes> | Max time to wait for CI |
--required-checks <checks> | Comma-separated required check names |
Strategies
| Strategy | Description |
|---|---|
sequential | Test and merge one PR at a time |
parallel | Test multiple PRs together, bisect on failure |
adaptive | Start parallel, fall back to sequential on failures |
Examples
Example Output
enable
Enable the merge queue for a branch.Options
| Option | Description |
|---|---|
-b, --branch <branch> | Branch to enable (default: main) |
Examples
disable
Disable the merge queue for a branch.Options
| Option | Description |
|---|---|
-b, --branch <branch> | Branch to disable (default: main) |
Examples
Queue States
PRs in the merge queue go through these states:| State | Description |
|---|---|
pending | Waiting in queue |
preparing | Rebasing onto target branch |
testing | CI checks running |
ready | All checks passed, ready to merge |
merging | Merge in progress |
completed | Successfully merged |
failed | CI checks failed |
cancelled | Removed from queue |
Workflow Examples
Basic Merge Queue Workflow
Priority Handling
Monitoring the Queue
Best Practices
Keep PRs small
Keep PRs small
Smaller PRs reduce queue time and are less likely to conflict:
- Faster CI runs
- Lower chance of conflicts with other PRs
- Easier to review and merge
Use priorities wisely
Use priorities wisely
Reserve high priorities for urgent fixes:
- 80-100: Critical hotfixes
- 50-79: Important features
- 20-49: Normal work
- 0-19: Low priority cleanup
Monitor queue health
Monitor queue health
Regularly check queue statistics:High wait times may indicate CI bottlenecks.
Choose the right strategy
Choose the right strategy
sequential: Best for small teams or repos with flaky testsparallel: Best for large teams with reliable CIadaptive: Best default choice for most teams
Troubleshooting
PR stuck in queue
PR stuck in queue
Check the status and CI logs:The PR may be waiting for CI or have failing checks.
Queue processing slowly
Queue processing slowly
Check if CI is the bottleneck:Consider:
- Switching to
parallelstrategy - Increasing batch size
- Optimizing CI pipeline
Frequent failures in parallel mode
Frequent failures in parallel mode
PRs may be conflicting with each other. Try:
Requirements
The merge queue requires:- A running wit server with merge queue enabled
- CI integration configured for the repository
- Appropriate permissions to add/remove PRs