{"id":15290244,"url":"https://github.com/npm/npm-merge-driver","last_synced_at":"2025-10-07T03:32:25.743Z","repository":{"id":51927094,"uuid":"112821864","full_name":"npm/npm-merge-driver","owner":"npm","description":"git merge driver for resolving conflicts in npm-related files","archived":true,"fork":false,"pushed_at":"2021-05-09T00:57:25.000Z","size":604,"stargazers_count":271,"open_issues_count":24,"forks_count":20,"subscribers_count":11,"default_branch":"latest","last_synced_at":"2024-10-01T16:06:29.303Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/npm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2017-12-02T07:25:19.000Z","updated_at":"2024-08-24T19:18:10.000Z","dependencies_parsed_at":"2022-08-23T20:41:00.410Z","dependency_job_id":null,"html_url":"https://github.com/npm/npm-merge-driver","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npm%2Fnpm-merge-driver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npm%2Fnpm-merge-driver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npm%2Fnpm-merge-driver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npm%2Fnpm-merge-driver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/npm","download_url":"https://codeload.github.com/npm/npm-merge-driver/tar.gz/refs/heads/latest","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235586070,"owners_count":19014028,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-30T16:06:34.584Z","updated_at":"2025-10-07T03:32:20.455Z","avatar_url":"https://github.com/npm.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm](https://img.shields.io/npm/v/npm-merge-driver.svg)](https://npm.im/npm-merge-driver) [![license](https://img.shields.io/npm/l/npm-merge-driver.svg)](https://npm.im/npm-merge-driver) [![Travis](https://img.shields.io/travis/npm/npm-merge-driver.svg)](https://travis-ci.org/npm/npm-merge-driver) [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/npm/npm-merge-driver?svg=true)](https://ci.appveyor.com/project/npm/npm-merge-driver) [![Coverage Status](https://coveralls.io/repos/github/npm/npm-merge-driver/badge.svg?branch=latest)](https://coveralls.io/github/npm/npm-merge-driver?branch=latest)\n\n# npm-merge-driver(1) -- git merge driver for automatic merging of lockfiles\n\n### Automatic Setup (recommended):\n\nTo start using it right away:\n\n```\n$ npx npm-merge-driver install --global\n```\n\n**Or** install it locally, per-project:\n```\n$ cd /path/to/git/repository\n$ npx npm-merge-driver install\n```\n\n...And you're good to go!\n\nNext time your lockfile has a conflict, it will be automatically fixed. You\ndon't need to do anything else.\n\n### Example\n\n```\n$ npx npm-merge-driver install\n$ git merge my-conflicting-branch\nnpm WARN conflict A git conflict was detected in package-lock.json. Attempting to auto-resolve.\n\nadded 1 package in 0.077s\nAuto-merging package-lock.json\nMerge made by the 'recursive' strategy.\n package-lock.json | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n$ git status\n\u003cclean\u003e\n```\n\n### Advanced\n\nThe following section is only for advanced configuration of the driver if you\nhave specific needs.\n\n#### Setup Options\n\n`npm-merge-driver install` supports a couple of config options:\n\n`--driver` - string to install as the driver in the git configuration\n\n`--driver-name` - string to use as the merge driver name in your configuration\n\n`--files` - list of files that will trigger this driver\n\n`--no-legacy` - disables retrying legacy commands on error\n\n#### Merge Options\n\n`npm-merge-driver merge` can also be configured:\n\n`-c, --command` - command to execute when a lockfile is conflicted\n\n`--no-legacy` - disables retrying legacy commands on error\n\n#### Install as Dependency\n\nTo avoid regular `npx` installs, consider installing the driver:\n\n`$ npm install [-g|--save-dev] npm-merge-driver`\n\n#### Manual Setup (advanced):\n\n`npm-merge-driver` requires two git configurations to work: a git configuration\nto add the driver to git, which is by default your local `.git/config` file, and\na `gitattributes(5)` configuration, which is by default your local\n`.git/info/attributes`.\n\nIf you **do not** want `npm-merge-driver` to install itself for you:\n\nAdd the driver to `.git/config`:\n```\n$ git config merge.\"npm-merge-driver\".name \\\n    \"Automatically merge npm lockfiles\"\n$ git config merge.\"npm-merge-driver\".driver \\\n    \"npx npm-merge-driver merge %A %O %B %P\"\n```\n\nAdd the relevant attributes to `.gitattributes` or `.git/info/attributes`:\n```\npackage-lock.json merge=npm-merge-driver\nnpm-shrinkwrap.json merge=npm-merge-driver\n```\n\n#### Using with other package managers\n\n`npm-merge-driver` can be used with package managers other than npm! It's a bit\nmore verbose, but works just as well, assuming the package manager has a command\nthat can automatically resolve merge conflicts in its lockfile:\n\n```\n$ npx npm-merge-driver install \\\n    --driver-name yarn-merge-driver \\\n    --driver \"npx npm-merge-driver merge %A %O %B %P -c yarn\" \\\n    --files yarn.lock\n```\n\n...and now, any time `yarn.lock` has a conflict, it will be automatically\nresolved without you having to manually run `yarn`.\n\n#### Uninstalling\n\nTo remove an installed merge driver, use `npm-merge-driver uninstall`:\n\n```\n$ npx npm-merge-driver uninstall [--global] [--driver-name=npm-merge-driver]\n```\n\n## AUTHOR\n\nWritten by [Kat Marchan](https://github.com/zkat)\n\n## REPORTING BUGS\n\nPlease file any relevant issues [on Github.](https://github.com/npm/npm-merge-driver)\n\n## LICENSE\n\nThis work is released under the terms of the ISC license. See `LICENSE.md` for details.\n\n## SEE ALSO\n\n* `git-config(1)`\n* `gitattributes(5)`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnpm%2Fnpm-merge-driver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnpm%2Fnpm-merge-driver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnpm%2Fnpm-merge-driver/lists"}