Skip to contentSkip to conversation

--color-diff='.' considered useful

PATCH In review Michael J Gruber 2 participants 4 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 4 lines · Michael J Gruber

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.

Signature · 2 lines
Matthieu Moy
http://www-verimag.imag.fr/~moy/
#2 lore raw

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

It's just so useful.

---
 Documentation/diff-options.txt | 3 +++
 1 file changed, 3 insertions(+)
Documentation/diff-options.txt +3 -0
index d56ca90..306b7e3 100644
@@ -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
Signature · 1 line
2.6.3.507.gca54332
#3 lore raw

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

Quoted 1 line · Michael J Gruber

It's just so useful.

Thanks,

Signature · 2 lines
Matthieu Moy
http://www-verimag.imag.fr/~moy/