I want to calculate this in bash file
files : {
{
file {
name: "Bla,java"
line_changes : [45,146,14]
}
}
{
file {
name: "Foo.java"
line_changed : [7,8,9,10]
}
}
}
so I have this
gitOutput=$(git diff origin/master..origin/mybranch)
echo $gitOuput
My problem is :
The output is sooo, not formatted.
Everything is in one line
I cannot parse it logically...
Like Split by \n or split by "diff --git" etc
Also there are no new line . So if there are some, it doesnot make sense.
So I want to know, is there any pretty format option for git diff
[UPDATE]
I have tried this weird approach
git diff origin/master..origin/mybranch > data.txt
data=$(cat data.txt)
Output is : The data.txt is absolutely perfect but the data var. is all messed up...
is it something related to IFS ???