Prioritising urgent changes in a merge queue Jump to heading
A merge queue is built for steady throughput: entries batch together, each batch is tested on top of the ones ahead, and nothing lands untested. During an incident that design works against you. The fix is approved, but there are eleven entries ahead of it, each batch takes nine minutes, and production is down. The temptation is to bypass the queue β merge directly, skip checks β which is how incident fixes end up breaking main a second time. Queues offer better options: moving an entry to the front, testing it alone rather than in a batch, and as a last resort a documented bypass with consequences everyone understands. This page sets those up before you need them, within merge queues and required checks.
When to use this approach Jump to heading
- Your default branch uses a merge queue or merge train, and incidents sometimes need fixes landed quickly.
- An urgent fix once waited behind a long queue, or someone bypassed the queue and broke main.
- You want a predictable, rehearsed path for urgent changes rather than improvisation.
- The queue is already set up, as in setting up a GitHub merge queue.
Step 1 β Use jump-to-front first Jump to heading
Most queues let a maintainer place an entry at the head. The entry is still tested β on top of the current main, without the entries it skipped β so the guarantee holds; only the order changes.
# GitHub: add a PR to the front of the merge queue (GraphQL)
gh api graphql -f query='
mutation($pr: ID!) { enqueuePullRequest(input: {pullRequestId: $pr, jump: true}) {
mergeQueueEntry { position } } }' \
-f pr="$(gh pr view 951 --json id --jq .id)" # GitLab: "merge immediately" restarts the train; prefer adding to the train first if time allows
glab mr merge 951 --auto-merge Jumping invalidates the batches already running, which restart behind the urgent entry. That cost is acceptable for an incident; it is why jumping should be reserved for incidents.
Step 2 β Keep the urgent entry out of a batch Jump to heading
If the urgent entry is batched with others and one of them fails, the urgent fix is delayed by bisection. Configure the queue so an entry at the head can be tested alone, or set a minimum group size of one and let the queue form a batch only when entries accumulate.
# Repository ruleset (merge queue parameters, GitHub) β illustrative values
merge_queue:
grouping_strategy: ALLGREEN
min_entries_to_merge: 1 # never wait for others to form a batch
max_entries_to_build: 5
min_entries_to_merge_wait_minutes: 2 With min_entries_to_merge at one, a jumped entry starts testing immediately rather than waiting for the accumulation window.
Step 3 β Make the fix itself small Jump to heading
The fastest pipeline is the one with least to do. An incident fix should be the smallest change that restores service β often a revert β not a refactor. A revert of a recent merge is easy to review and almost always passes CI.
git switch -c incident/revert-search-index main
git revert -m 1 5a9e3c1 --no-edit
git push -u origin HEAD && gh pr create --title "Revert #812: index rebuild locks orders table (INC-4471)" --fill Reverting merges correctly is covered in undoing a bad merge on a shared branch.
Step 4 β Document a break-glass bypass for when the queue itself is broken Jump to heading
Sometimes the queue cannot help: CI is down, the queue is stuck, or the required checks themselves are the problem. For that case, define a bypass in advance: who may use it, how, and what follows. A ruleset bypass list containing only an incident team, with bypass through pull request only, leaves a reviewed record.
Break-glass merge (documented in the incident runbook)
Who: members of @acme/incident-commanders only
When: CI or the merge queue is unavailable AND production impact is ongoing
How: merge the reviewed PR with the ruleset bypass ("merge without waiting for requirements")
After: run the full pipeline on main immediately; post the run link in the incident channel Temporary elevation for the incident team is covered in granting temporary elevated access with expiry.
β οΈ SAFETY WARNING: A bypass merge lands a commit that was not tested on top of the current main. If another change landed in the meantime, the combination is untested and may break main. Immediately after any bypass, run the full pipeline on main and be ready to revert. Every bypass should appear in the incident review.
Step 5 β Rehearse and review Jump to heading
An urgent path that nobody has tried fails under pressure. Rehearse it during a calm week β jump a trivial pull request, time it β and include queue behaviour in incident reviews.
# How often was the queue jumped or bypassed last quarter, and why?
gh api "repos/$OWNER/$REPO/rulesets/rule-suites?time_period=quarter&rule_suite_result=bypass" \
--jq '.[] | "\(.pushed_at[:10]) \(.actor_name) \(.ref)"' Validation checklist Jump to heading
Frequently Asked Questions Jump to heading
Does jumping to the front skip any checks? Jump to heading
No. The entry is tested with all required checks on top of the current main. It skips waiting, not testing.
What if two urgent fixes arrive at once? Jump to heading
Jump both; they form the head of the queue in order and are tested together or in sequence according to the queueβs grouping. If either fails, the other proceeds after bisection.
Should hotfix branches bypass the queue entirely? Jump to heading
If they target main, no β they should take the fast path through it. Fixes targeting a release branch go through that branchβs own process, as in hotfix branches that do not drift from main.
Related Jump to heading
- Merge Queues & Required Checks β the parent topic.
- Debugging a Stuck Merge Queue β when the queue itself is the incident.
- GitLab Merge Trains β the GitLab equivalent of the options here.
- Rolling Back a Deployment with Git β restoring service while the fix is in the queue.