I think for simple cases the regex can be much shorter and easier to remember, with the caveat that this will not work if you have changes in the line where the line itself starts with + or -
$ git diff | grep '^[+|-][^+|-]'
The regular expression says that the line should begin with + or - , and immediately the next character should be neither one nor the other. I got the same results if I couldnβt escape + or not here, btw ...
Example:
$ cat testfile A B C D E F G
Say I change C to X , E to Y and G to Z
$ git diff | grep '^[+|-][^+|-]' -C +X -E +Y -G +Z
As I said above, this is easy for most cases. If you pass this output to a dout file, try the same regular expression, it will not work.
$ git diff dout | grep '^[+|-][^+|-]' $
Anyway, hope this helps in your case
galois Dec 07 '17 at 19:18 2017-12-07 19:18
source share