git
thinks that two versions of a .json
file is different, but actually their data is not:
@@ -469,9 +479,9 @@
"integrity": "sha1-+GzWzvT1MAyOY+B6TVEvZfv/RTE=",
"dev": true,
"requires": {
+ "JSONStream": "1.3.1",
"combine-source-map": "0.7.2",
"defined": "1.0.0",
- "JSONStream": "1.3.1",
"through2": "2.0.3",
"umd": "3.0.1"
}
How can we tell git to ignore such differences for JSON files?
Note:
Following code from Tomasz Wegrzanowski's Blog:
echo "*.json diff=json" >> .gitattributes
git config diff.json.textconv json_pp
is not working and causing hangs on git diff
I thing you config hangs cause json_pp doesnt accept the filename as parameter. That means in your config json_pp waits for inputs on std-input stream, and cause you don`t deliver any input streams your git diff hangs In my gitconfig I have implemented json_pp like this:
For me this works fine. If you like you can change the
--json_opt
values to have you favorite output-format. But if the order of keys change this config will still show a difference.Tested in git-version 2.16.1.windows.1