بنقرة واحدة
merge-conflict-resolving
// You resolve merge conflicts in code repositories, ensuring that the final merged code is functional and free of errors, and adheres to our code quality standards.
// You resolve merge conflicts in code repositories, ensuring that the final merged code is functional and free of errors, and adheres to our code quality standards.
Domain knowledge for remediating CVEs in the iTwin.js Rush monorepo — pnpm-config.json structure, fix strategies, validation, and audit workflows.
Additional iTwin.js PR review heuristics focused on consumer impact, compatibility, invariants, UI evidence, and docs accuracy.
| name | merge-conflict-resolving |
| description | You resolve merge conflicts in code repositories, ensuring that the final merged code is functional and free of errors, and adheres to our code quality standards. |
Resolve merge conflicts in backport PRs from Mergify. Mergify uses cherry-pick (not merge) to create backport branches with the pattern mergify/bp/release/X.X.x/pr-NNNN. When cherry-pick fails, Mergify comments with the conflict details and the branch must be fixed locally.
Prerequisite: This skill references the cve-remediation skill for understanding pnpm-config.json structure (globalOverrides, ignoreCves). Load that skill when resolving conflicts in security-related backports.
mastermergify/bp/release/X.X.x/pr-NNNNgit status locally to identify conflicts)To start resolving:
git fetch origin
git checkout mergify/bp/release/X.X.x/pr-NNNN
git cherry-pick --continue # If mid cherry-pick
# OR
git merge origin/release/X.X.x # If syncing with target branch
Always regenerate. Never manually edit.
rush update
# or for persistent issues:
rush update --full
Commit with: git commit -m "resolve pnpm-lock conflicts"
File: common/config/rush/pnpm-config.json
This is the most common conflict file in security backports. It contains globalOverrides (dependency version overrides) and ignoreCves (audit exceptions). For detailed structure, see the cve-remediation skill.
Keep all existing entries from the release branch (HEAD). Add new entries from the incoming change.
globalOverrides or ignoreCves)Release branch (HEAD) has:
"globalOverrides": {
"cross-spawn": "^7.0.5",
"axios": "^1.13.5"
}
Incoming change adds serialize-javascript override:
"globalOverrides": {
"cross-spawn": "^7.0.5",
"axios": "^1.13.5",
"serialize-javascript": "^7.0.3"
}
After resolving, always run rush update to regenerate the lock file.
Examples: PR #9007, PR #9041, PR #9049
Rule: When backporting to release/X.X.x, keep the release branch's version information and only accept new functional changes.
"version": "5.5.0"workspace:* for internal deps — do not convert to hardcoded versions unless the release branch already uses them)After resolving, always run rush update to regenerate the lock file.
Avoid:
rush update after editing package.jsonAlways regenerate. Never manually edit.
These files track the public API surface and are generated by rush extract-api. They conflict when the release branch has a different API surface than master.
rush build
rush extract-api
Also regenerate the export summary files: common/api/summary/*.exports.csv
Example: PR #8986 — backport of integrityCheck() modified common/api/core-backend.api.md
Rush change files are JSON files in common/changes/@itwin/<package>/ created by rush change. They usually have unique filenames and rarely conflict.
If they do conflict: Keep both files. If the same file has conflicts, merge the JSON content.
If change files are needed for the backport: Generate them non-interactively:
rush change --verify -b origin/release/X.X.x
# If needed:
rush change --bulk --message "" --bump-type none -b origin/release/X.X.x
Example: PR #8345 — had 30+ rush change files for a multi-package backport
Resolution depends on whether the target release branch has already shipped its initial release (X.X.0).
X.X.0 already been released?Check whether a version-specific changelog file already exists on the release branch:
# For a backport targeting release/5.7.x:
ls docs/changehistory/5.7.0.md
# Or check git tags:
git tag --list 'release/5.7.*'
If X.X.0.md exists (or the release/X.X.0 tag exists), the initial release has shipped and NextVersion.md on that branch should be empty.
X.X.0.md exists)On backport branches targeting release/X.X.x after the X.X.0 release, NextVersion.md on the release branch (HEAD) is intentionally empty. The incoming side from master will have content that was written for the next major/minor release — not for this patch branch.
Resolution:
NextVersion.md empty — resolve to the HEAD (release branch) side, which has only the frontmatter and heading:
---
publish: false
---
# NextVersion
X.X.0.md — extract only the changelog entries that correspond to the change being backported (ignore unrelated master content like new features). Place them under the appropriate section in docs/changehistory/X.X.0.md.X.X.0.md and add the entry under the matching category (e.g., ## Display > ### Fixes). Create a subsection if needed.What to discard: Any incoming NextVersion.md content that describes features or changes not being backported. These belong on master only.
Example: PR #9059 backport — incoming side had both a WithQueryReader feature (master-only) and a reality data fix (being backported). Only the fix was moved to 5.7.0.md.
X.X.0.md)NextVersion.md is still the active changelog for the upcoming release. Merge both versions intelligently:
Example: If one branch adds Electron support and another adds Presentation changes, include both sections in the proper order.
npx markdownlint docs/changehistory/NextVersion.md
rush docs # Ensure documentation builds
Avoid:
NextVersion.md content into a post-release patch branchX.X.0.mdCI workflows and configuration files can diverge significantly between major release branches.
Common conflicting files:
.github/workflows/extract-api.yaml — node version, action versions.github/mergify.yml — backport target branches.github/workflows/*.yaml — CI pipeline changesResolution: Generally keep the release branch's CI configuration. Only accept incoming changes that are specifically being backported (e.g., a node version bump needed for compatibility).
Example: PR #9049 — needed additional edit to bump node version in extract-api.yaml for the older release branch
Rare in backports but possible when the same code area was modified on both branches.
Resolution:
Sometimes Mergify cannot cherry-pick cleanly because multiple related changes need to land together. In this case, combine the changes into a single backport PR.
Example: PR #9007 — combined 3 separate PRs into one backport due to dependency conflicts
When combining:
Identify conflict type: Run git status to see which files need resolution
Apply strategy:
rush update → stage → commitrush update → stage both files → commitrush update → stage both files → commitrush build → rush extract-api → stage → commitX.X.0.md exists → Scenario A (keep empty, move to X.X.0.md) or B (merge both) → stage → commitCheck for residual conflict markers:
grep -r "<<<<<<< " . --include="*.ts" --include="*.json" --include="*.md" --include="*.yaml" --include="*.yml"
Verify: Run rush build and ensure CI passes
Commit messages:
"resolve pnpm-lock conflicts""resolve pnpm-config.json conflicts in backport""resolve package.json conflicts in backport""regenerate api files after backport""merge NextVersion.md from both branches""resolve conflicts"If resolution goes wrong:
# Abort an in-progress cherry-pick
git cherry-pick --abort
# Or reset to the last good state (before the cherry-pick)
git reset --hard ORIG_HEAD
git clean -fd
# Then re-attempt
rush update
| File Type | Path | Resolution | Key Points |
|---|---|---|---|
| Lock file | common/config/rush/pnpm-lock.yaml | rush update | Never manually edit |
| pnpm-config | common/config/rush/pnpm-config.json | Manual edit + rush update | Keep release entries, add new. See cve-remediation skill for structure |
| package.json | <package>/package.json | Manual edit + rush update | Keep release versions, add new deps only |
| API signatures | common/api/*.api.md | rush build + rush extract-api | Never manually edit |
| Rush change files | common/changes/@itwin/*/ | Keep both or regenerate | Usually unique filenames, rarely conflict |
| NextVersion.md | docs/changehistory/NextVersion.md | See scenarios A/B | If X.X.0.md exists: keep empty, move entries to X.X.0.md. Otherwise: merge both. |
| CI/config | .github/workflows/*.yaml | Manual edit | Favor release branch config |
master vs release/X.X.xgit cherry-pick --continue, not mergegrep -r "<<<<<<< " . before committingrush build, rush extract-api, and check git diffcve-remediation skill — For understanding pnpm-config.json structure when resolving security backport conflicts