Skip to content

Instantly share code, notes, and snippets.

@cmbuckley
Last active December 7, 2021 21:11
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmbuckley/6999ea7228f0cb9e50c060cd64879fd2 to your computer and use it in GitHub Desktop.
Save cmbuckley/6999ea7228f0cb9e50c060cd64879fd2 to your computer and use it in GitHub Desktop.
Using gron as an external git diff driver
*.json diff=gron
[diff "gron"]
textconv=gron --no-sort
[core]
# or omit this and put the attributes file
# in ~/.config/git/attributes instead
attributesfile=~/.gitattributes
@cmbuckley
Copy link
Author

cmbuckley commented Feb 24, 2021

This allows you to use gron as an external diff tool for git.

You just need both of these files in your $HOME, plus gron of course 😄

Usage:

git show HEAD:test.json
{
  "foo": "bar"
}

cat test.json
{
  "foo": "bar",
  "baz": "quux"
}

git diff test.json
diff --git test.json test.json
index c8c4105..3fe4371 100644
--- test.json
+++ test.json
@@ -1,2 +1,3 @@
 json = {};
 json.foo = "bar";
+json.baz = "quux";

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