A backlog of conflicting pull requests is not just a Git problem. In a multi-repository environment, each speculative branch update can launch another CI run, create another preview deployment and consume capacity needed for essential operations. The worst possible solution is to resolve the conflicts mechanically, rerun everything and merge regardless of the result.
This field guide describes a real cleanup across a portfolio of websites, without identifying the repositories or publishing private operational data. It follows the investigation in my CI/CD optimization case study. The emphasis here is on preserving the intent of each change while reducing the number of builds and deployments required to deliver it.
1. Inventory the backlog before editing branches
Start with the current head, base branch, mergeability, changed files, workflow outcomes and required checks for every open pull request. Do not assume that an old pull request is still needed just because it is open.
The GitHub CLI can provide a read-only starting point:
gh pr list --state open --limit 100 \
--json number,title,headRefName,headRefOid,baseRefName,isDraft
gh pr view 123 --json mergeable,mergeStateStatus,headRefOid,statusCheckRollup
gh pr diff 123Mergeability may initially be unknown while GitHub calculates it. Check again before classifying a pull request as conflicting. A conflict-free branch, a successful CI run and a successful production deployment are three different states.
In the investigated portfolio, the main sources of overlap were successive versions of CI optimizations and automated SEO changes targeting the same pages. Roughly three quarters of the initial backlog were resolved or consolidated in the first cleanup. The remaining branches were conflict-free but still waiting for successful CI. Those pending checks must not be counted as passed.
2. Classify changes by intent, not by age
| Pull request type | Resolution strategy |
|---|---|
| Duplicate optimization | Confirm its functional changes already exist on the base; close with an explanation |
| Overlapping workflow changes | Preserve current release gates and incorporate only missing improvements |
| Competing metadata edits | Keep complete titles and current factual claims; reconcile the useful wording |
| Independent code changes | Merge the current base into the topic branch and run its required checks |
| Changes touching secrets, backups or production policy | Review separately; never infer authorization from a conflict resolution |
This avoids an especially common failure mode: restoring an obsolete workflow that accidentally re-enables automatic preview builds or removes a recent security guardrail.
SEO proposals deserve the same review as code. An automatically shortened title ending in an ellipsis is not necessarily an improvement. If the framework supports a separate SEO title, use a complete, concise value there and retain the full article heading. Avoid changing canonical URLs or introducing unsupported claims while reconciling metadata.
3. Resolve against the latest base without rewriting history
For a branch that belongs to you, use an ordinary merge of the current base into the topic branch rather than force-pushing a rewritten history. First make sure the working tree is clean and the expected head has not moved.
git status --short
git fetch origin
git switch feature/topic
git merge --no-commit --no-ff origin/main
# Review each conflict and edit the affected files.
git diff --name-only --diff-filter=U
git add path/to/resolved-file
git diff --cached --check
git diff --cached
git commit -m "Resolve conflicts against main"
git push origin HEADIf there are unexpected changes, stop and investigate rather than selecting one entire side of the conflict. If necessary, abort an in-progress merge using git merge --abort after preserving any work you need.
For API-based tooling, the equivalent is to construct a reviewed tree from the latest base plus the intended changes, create a merge commit with both parents, then update the topic ref only if its expected head still matches. The important properties are preservation of history, explicit review of the final tree and protection against concurrent branch updates.
When multiple PRs target the same files, a single reviewed integration can incorporate their useful changes. Record which proposals were superseded and why. Preserve their history when merging, rather than creating a sequence of almost identical production deployments.
4. Do not confuse a failed admission with a failed test
A failed workflow is not always a failed assertion. Inspect the jobs and their executed steps:
gh run view RUN_ID --json status,conclusion,jobs
gh run view RUN_ID --log-failedDuring the cleanup, some jobs failed before any steps were recorded, and logs were unavailable. That is consistent with runner admission or quota problems, but missing logs alone do not prove which limit caused the failure.
Separate the following states in dashboards and automation:
- Not executed: no runner steps ran; investigate capacity, permissions or service availability.
- Executed and failed: diagnose the actual failing command or assertion.
- Executed and passed: the applicable tests completed successfully for the reviewed commit.
- Deployment blocked: the source may be mergeable, but the hosting service has not promoted it.
Repeatedly rerunning a job that cannot acquire a runner is not a recovery strategy. Confirm the available allowance and retry only the affected failed jobs when capacity returns. Do not increase spending limits merely to clear a queue.
5. Make every push cheap and daily maintenance predictable
The target architecture separates fast change validation from deeper scheduled monitoring. Keep lint, type checks, relevant unit tests, security checks and essential release gates on the change path. Perform broader live-site audits once daily when practical. Operational schedules with independent reliability requirements should remain separate.
For public sites, public HTTP, social-card and Lighthouse checks can run from a public monitoring repository with standard GitHub-hosted runners. Never copy private source or privileged credentials into that repository just to avoid billed minutes. Use least-privilege tokens only where access is authorized.
For a static site, build once and reuse the artifact for validation and deployment when the framework and hosting platform support it. Private repositories may benefit from a lean CI path and a single production build on the hosting service. Compare actual billable minutes and hosting charges instead of assuming that moving work always saves money.
A minimal example for noncritical scheduled HTTP checks:
name: Daily public health check
on:
schedule:
- cron: '41 6 * * *'
permissions:
contents: read
concurrency:
group: public-health
cancel-in-progress: false
jobs:
health:
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Check public homepage
run: curl --fail --silent --show-error --location --max-time 30 https://example.com/Choose a supported runner image and validate tool compatibility before changing it. Newer Linux images are not automatically cheaper or more reliable if browser installation fails. Cache dependency downloads using lockfile-based keys and separate browser caches by version, operating system and architecture. Do not cache credentials.
6. Automate merge decisions, not blind merges
Native GitHub auto-merge is useful when enabled and supported by the repository’s protection rules. If it is unavailable, a narrowly scoped scheduled controller can review outstanding PRs and act only when its own eligibility conditions are met.
Before merging, verify the expected head SHA, current base, reviewed diff, successful applicable CI, required approvals and unresolved review threads. A mergeable status is necessary but not sufficient. A zero-step failure is not a green check. Never use an administrative override to hide a failed gate.
After merging, verify the actual production deployment separately. A blocked deployment must remain visible as an unresolved operational issue, even when GitHub reports the PR as merged.
7. Measure the outcome
Track open conflicts, PR age, successful checks, admission failures, billable runner minutes, preview deployments, production deployments and cost by service. Count consolidated PRs separately from independently deployed changes.
The operational result of the initial cleanup was a conflict-free remaining queue and fewer competing deployment proposals. Some changes were integrated, while others awaited successful validation. A full monthly cost comparison and confirmation of the remaining production deployments were still outstanding.
The goal is not a dashboard with zero open PRs at any cost. It is a small, reviewable delivery queue that preserves the latest work, spends compute where it improves confidence and publishes only changes that satisfy the release policy.
