Resolve a Package.resolved merge conflict without random upgrades
Treat Package.resolved as a record of selected dependency versions. Resolve the project requirements first, regenerate deliberately, and review the resulting revisions.
Treat Package.resolved as a record of selected dependency versions. Resolve the project requirements first, regenerate deliberately, and review the resulting revisions.
Try these fixes in order
Preserve both sides
Before editing, note each branch’s dependency rule changes and pinned versions. Do not simply keep an older lockfile if requirements changed.
Resolve the source conflict
Merge the Xcode project or Package.swift dependency declarations and confirm which versions the merged project permits.
Regenerate with Xcode
Use Resolve Package Versions after the declarations are valid. For a standalone package, run the resolver in the package root.
swift package resolveReview CI behavior
Inspect the Package.resolved diff and run a build. Commit the merged lockfile so CI uses the intended revisions.
Interpret what you see
Both branches changed the same pin
What it suggests: The conflict is about selected versions, not just text formatting.
Next check: Merge dependency declarations first, then resolve once with the intended Xcode version.
The regenerated file upgrades unrelated packages
What it suggests: Broad re-resolution changed more than the conflict required.
Next check: Review the lockfile diff and constrain or restore unintended changes before committing.
The merge passes locally but fails in CI
What it suggests: CI may use a different lockfile path or toolchain.
Next check: Compare the committed file, workflow checkout, and selected Xcode version.
Why this happens
- Both branches changed pinned package versions.
- The merged requirement excludes a previously pinned revision.
Still not working?
Avoid deleting Package.resolved as a routine fix: that may silently upgrade unrelated dependencies.
Official sources
These steps are based on the linked documentation and general diagnostics. BugMedic has not independently tested every product and system configuration. Review commands before running them.