Maybe you can solve that with the --word-diff-regex
option. This is what I did: I created a simple file and committed it with the following content.
first line
second line
third line
Then I modified it like this:
first line;
second; line;
third changed line;
If I have correctly understood, you need to show only the following differences:
second -> second;
third line -> third changed line
You can partially do this executing:
git diff --word-diff-regex='[^ \\n;]+' HEAD..HEAD~1
And this is the output:
first line
second line
third[-changed-] line
I said partially because even if I found a regex to detect also the first change ('[^ \\n]+(?!\\n|$)'
), git does not seem to accept it, for some reason I am not aware of (I am still working on it).
Anyway, the logic behind it is that this option "overrides" how git considers a word. I know this is not the right regex since it is not covering several cases, change it based on your needs (for example if you consider test1;test2
a word).
post-checkout
hook?| grep
doesn't meet your needs, maybegit diff -G
orgrepdiff
can do the job (linux.die.net/man/1/grepdiff)