When I do a git diff, it shows lines that have been added:
+ this line is added
lines that have been removed:
- this line i
I think for simple cases the regex can be much shorter and easier to remember, with the caveat that this won't work if you have line changes where the line itself starts with + or -
$ git diff | grep '^[+|-][^+|-]'
The regex says the line should start with + or -, and the immediately following character should be neither of those. I got the same results whether I escaped the + 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
Like I said above, though, this is just for most cases. If you pipe that output to a file dout, then try the same regex, it won't work.
$ git diff dout | grep '^[+|-][^+|-]'
$
Anyways, hope that helps in your case