Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jonatanpedersen/git-json-merge
A git merge driver that use xdiff to automatically resolve merge conflicts in json files. This project was inspired by git-po-merge.
https://github.com/jonatanpedersen/git-json-merge
cli git json merge
Last synced: 5 days ago
JSON representation
A git merge driver that use xdiff to automatically resolve merge conflicts in json files. This project was inspired by git-po-merge.
- Host: GitHub
- URL: https://github.com/jonatanpedersen/git-json-merge
- Owner: jonatanpedersen
- License: mit
- Created: 2015-11-30T07:19:48.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2024-03-18T11:23:30.000Z (10 months ago)
- Last Synced: 2024-12-16T16:27:42.152Z (12 days ago)
- Topics: cli, git, json, merge
- Language: JavaScript
- Homepage:
- Size: 76.2 KB
- Stars: 107
- Watchers: 7
- Forks: 14
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# git-json-merge
A git merge driver that use [xdiff](https://github.com/dominictarr/xdiff) to automatically resolve merge conflicts in json files. It also detects indentation automatically. This project was inspired by [git-po-merge](https://github.com/beck/git-po-merge).
[![@git-json-merge](https://circleci.com/gh/jonatanpedersen/git-json-merge.svg?style=shield)](https://app.circleci.com/pipelines/github/jonatanpedersen/git-json-merge)
[![NPM Version](https://img.shields.io/npm/v/git-json-merge.svg)](https://www.npmjs.com/package/git-json-merge)## Install
This can be done one of two ways, globally or per-project/directory:
### Globally
Install:
```sh
npm install --global git-json-merge
```Add to `~/.gitconfig`:
```ini
[core]
attributesfile = ~/.gitattributes
[merge "json"]
name = custom merge driver for json files
driver = git-json-merge %A %O %B
```Create `~/.gitattributes`:
```ini
*.json merge=json
```### Single project / directory
Install:
```sh
npm install git-json-merge --save-dev
```Update git config:
```sh
git config merge.json.driver "$(npm bin)/git-json-merge %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:
- http://git-scm.com/docs/gitattributes#_defining_a_custom_merge_driver
- http://stackoverflow.com/questions/28026767/where-should-i-place-my-global-gitattributes-fileThanks:
- https://gist.github.com/mezis/1605647
- http://stackoverflow.com/questions/16214067/wheres-the-3-way-git-merge-driver-for-po-gettext-files