Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 15, 2026

Configure pnpm-lock.yaml Merge Driver

Setting up a custom Git merge driver to automatically handle merge conflicts in pnpm-lock.yaml by regenerating the file using pnpm install.

Changes:

  • Create .gitattributes file with merge driver configuration for pnpm-lock.yaml
  • Add postinstall script to automatically configure Git merge driver
  • Update CONTRIBUTING.md with documentation about the merge driver
  • Verify the configuration is correct

Implementation Details:

  1. .gitattributes: Specifies that pnpm-lock.yaml should use the pnpm-merge custom merge driver
  2. package.json: Added postinstall script that runs:
    • git config merge.pnpm-merge.name "pnpm-lock.yaml merge driver"
    • git config merge.pnpm-merge.driver "pnpm install"
  3. CONTRIBUTING.md: Added documentation explaining the merge driver feature

How It Works:

When a merge conflict occurs in pnpm-lock.yaml, Git will automatically run pnpm install to regenerate the lock file instead of creating merge conflict markers. This ensures the lock file stays consistent and valid.

Original prompt

pnpm-lock.yaml merge=pnpm-merge
git config merge.pnpm-merge.name "pnpm-lock.yaml merge driver"
git config merge.pnpm-merge.driver "pnpm install"


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants