Skip to content

Instantly share code, notes, and snippets.

View eduard-malakhov's full-sized avatar

Eduard Malakhov eduard-malakhov

  • Larnaca, Cyprus
View GitHub Profile
@eduard-malakhov
eduard-malakhov / merge_versioned_json.sh
Last active April 28, 2020 05:48
Git merge driver for versioned JSON files that attempts to automatically resolve version conflicts across branches
#!/bin/bash
# This file attempts to implement a merge strategy for "versioned" JSON files like package.json.
# To use it as a git merge driver in a repository or globally, first set up the driver using
#
# git config merge.versioned-json.driver $(realpath merge_versioned_json.sh)
#
# or
#
# git config --global merge.versioned-json.driver $(realpath merge_versioned_json.sh)