threads / discuss / 40807

--color-diff='.' considered useful

Subject: --color-diff='.' considered useful

## tl;dr

4 messages between Nov 16, 2015 and Nov 20, 2015.

replies: 3people: 2as markdown or json

Michael J Gruber· Nov 16, 2015, 14:25 UTC · lore
git tip of the day:

git diff --color-words='.' git show --color-words='.'

That will help you find that 1 character change that a failed default word split hides from your eyes.

I guess everyone here will know already, but I found that super useful and much easier than trying to get a meaningful word split for that 100+ char TeX source line without a single space...

Cheers, Michael

Matthieu Moy· Nov 16, 2015, 14:34 UTC · re: Michael J Gruber · lore

Re: --color-diff='.' considered useful

Michael J Gruber <git@drmicha.warpmail.net> writes:
> git tip of the day:
>
> git diff --color-words='.'
> git show --color-words='.'

Probably my main usage of --color-words indeed (except I omit the single quotes ;-) ).

I think this deserves an explicit mention in the doc.
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Michael J Gruber· Nov 20, 2015, 13:36 UTC · re: Matthieu Moy · lore

[PATCH] Documentation/diff: give --word-diff-regex=. example

It's just so useful.
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
 Documentation/diff-options.txt | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index d56ca90..306b7e3 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -267,6 +267,9 @@ expression to make sure that it matches all non-whitespace characters.
 A match that contains a newline is silently truncated(!) at the
 newline.
 +
+For example, `--word-diff-regex=.` will treat each character as a word
+and, correspondingly, show differences character by character.
++
 The regex can also be set via a diff driver or configuration option, see
 linkgit:gitattributes[1] or linkgit:git-config[1].  Giving it explicitly
 overrides any diff driver or configuration setting.  Diff drivers
-- 
2.6.3.507.gca54332
Matthieu Moy· Nov 20, 2015, 14:59 UTC · re: Michael J Gruber · lore

Re: [PATCH] Documentation/diff: give --word-diff-regex=. example

Michael J Gruber <git@drmicha.warpmail.net> writes:
> It's just so useful.
Confirmed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Thanks,
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

← back to recent threads