Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save senhalil/fd5e06913523cb9d45b3123ebd186573 to your computer and use it in GitHub Desktop.
Save senhalil/fd5e06913523cb9d45b3123ebd186573 to your computer and use it in GitHub Desktop.
git diff -- use json_xs to pretty-print the json before diffing it
sudo apt-get install libjson-xs-perl
echo "*.json diff=json" >> ~/.gitattributes
git config --global core.attributesfile ~/.gitattributes
git config --global diff.json.textconv "json_xs -e \"print JSON::XS->new->utf8->pretty->canonical->encode(\\\$_)\" -t none < \"\$1\""
@senhalil
Copy link
Author

[diff "json"]
	textconv = json_xs -e \"print JSON::XS->new->utf8->pretty->canonical->encode(\\$_)\" -t none < \"$1\"

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