Aligning Dependencies After Lock File Conflicts

Compare package.json files from different branches to resolve dependency version conflicts that cause lock file merge issues.

Dependency Management

Detailed Explanation

Resolving Lock File Dependency Conflicts

Lock file conflicts are one of the most common merge conflicts in JavaScript projects. They happen when two branches modify package.json differently. The Package.json Diff tool helps you understand the underlying dependency changes that caused the conflict.

Typical conflict scenario

Branch A (feature-auth):
dependencies:
  + jsonwebtoken: ^9.0.2
  ~ axios: ^1.5.0 -> ^1.6.0

Branch B (feature-api):
dependencies:
  + @prisma/client: ^5.7.0
  ~ axios: ^1.5.0 -> ^1.6.2

Resolution workflow

  1. Compare main branch package.json with branch A to see branch A's changes
  2. Compare main branch package.json with branch B to see branch B's changes
  3. Identify overlapping changes (both modified axios, but to different versions)
  4. Create the merged package.json with the higher version of shared changes
  5. Verify the final result by comparing against main

Using the diff tool for each step

For each comparison:

  1. Paste the base (main) package.json in the left panel
  2. Paste the branch package.json in the right panel
  3. Filter to Changed only and Added only to see just the modifications
  4. Note overlapping changes for manual resolution

Preventing future conflicts

Strategy How
Renovate/Dependabot auto-merge Keep dependencies updated continuously
Branch from latest main Reduce drift between branches
Separate dependency PRs Don't mix feature changes with dependency updates
Use version ranges Allow lock file to resolve minor/patch automatically

Use Case

Two developers have been working on separate feature branches that both updated dependencies. When merging, the lock file has massive conflicts. They use Package.json Diff to compare each branch's package.json against main to understand what each branch changed.

Try It — Package.json Diff

Open full tool