I'm working with JSON files and I need to find changes to certain attributes over the commits I've done.
For example with this fake file I'd want to see the changes done to attr1, 2, 3, and 4, but not 5 (or any other not listed.)
File 1 commit A
{
"group": {
"attr1": "apples",
"attr2": "oranges"
},
"attr3": "",
"attr4": "grapes",
"attr5": "kiwi",
}
File 1 commit B
{
"attr3": "bananas",
"attr4": "",
"attr5": "strawberry",
"attr-new": "watermelon",
"group": {
"attr1": "pineapples",
"attr2": "oranges"
}
}
Wanted output for each file:
File 1 Changes:
attr1: "apples" to "pineapples"
attr3: "" to "bananas"
attr4: "grapes" to ""
I saw that git log has an -L option to search by line, but as you can see, the line numbers aren't consistent between the two commits. Also I know git log as a regex option to use, but I'm not familiar enough with regex to know if it would work here.
I'd need to do this for each file listed in the git log. How do I do this?