1.0.0 • Published 6 months ago

git-merge-packagejson v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

git-merge-packagejson

A git merge driver that use xdiff to automatically resolve merge conflicts in json files. It also detects indentation automatically. This project was inspired by git-po-merge.

NPM Version

Install

This can be done one of two ways, globally or per-project/directory:

Globally

Install:

npm install --global git-merge-packagejson

Add to ~/.gitconfig:

[core]
    attributesfile = ~/.gitattributes
[merge "packagejson"]
    name = custom merge driver for json files
    driver = git-merge-packagejson %A %O %B

Create ~/.gitattributes:

package.json merge=packagejson

Single project / directory

Install:

npm install git-merge-packagejson --save-dev

Update git config:

git config merge.json.driver "$(npm bin)/git-merge-packagejson %A %O %B"
git config merge.json.name "custom merge driver for json files"

Add the same .gitattributes where desired and commit. Note .gitattributes is only used after committed.

Helpful docs:

Thanks:

1.0.0

6 months ago

0.0.2

6 months ago

0.0.1

6 months ago