Exclude omitted lines in git-diff

Viewed 29

If we have this code below:

1: int a = 1;
2: int b = 2;
3: int c = 3;
4: int d = 4;

And we removed line 2 and 3, and change line 1 into int a = 0;

e.g.

1: int a = 0;
2: int d = 4;

git diff will show output like this:

1: - int a = 1;
2: - int b = 2;
3: - int c = 3;
4: + int a = 0;
5:   int d = 4;

How can I make git-diff not display the line 2 and 3 above? It should only output like this:

1: - int a = 1;
2: + int a = 0;
3:   int d = 4;

I am creating a script and it will be easier for me to parse the diff result if it will only show the modified line (lines that has been really updated e.g. changed some value within the line) not the deleted lines

Is this possible with git-diff? If not, are there any other option to solve this?

0 Answers
Related