I'd like to be able to show deletions in git diff that aren't followed by an addition.
That is, only show - lines that aren't followed by + lines. Is that possible?
git diff | awk '/^@/{ if(s) print p; s = 1; p="" }
s == 1 && /^\+/ { s = 0 } 1 {p = sprintf("%s\n%s", p, $0)}
END { if (s) print p }' s=2
git diff --numstat | awk '/^0/ {print $3}'
From the git-diff manpage:
The --numstat option gives the diffstat(1) information but is designed for easier machine consumption. An entry in --numstat output looks like this:
1 2 README 3 1 arch/{i386 => x86}/MakefileThat is, from left to right:
the number of added lines;
a tab;
the number of deleted lines;
a tab;
pathname (possibly with rename/copy information);
a newline.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With