Comment by gmartres
13 years ago
> Since it's aimed at line-oriented code, it does line-based diffs
You can do word diffs with git:
git diff --word-diff=color
13 years ago
> Since it's aimed at line-oriented code, it does line-based diffs
You can do word diffs with git:
git diff --word-diff=color
It's still recreating a word based diff from a line based diff.
See diff.c line 793 for how it works.
It may be doing that conversion, but the conversion works. For example, committing the following text (with line breaks), then joining it all into one line, shows no differences when using 'git diff --word-diff'.
The line does get reproduced on the terminal (a line diff was seen), but no text is shown in green or red to indicate an actual change.
Just checked with the old and new versions of Title_09.txt and you're right, --word-diff does the right thing. It echoes all the changed lines to the terminal, but it only marks up (and colors, in color mode) the changed words:
Wonder if there's a way to enable that behavior on GitHub? And/or to generate repository activity statistics based on changed words rather than changed lines?
Sure, but this particular test tells you nothing. You need one where the "line diff" has identified the wrong set of changes (IE it has decided two sets of text look close enough that one is really a change into the other, even though that's not what historically happened).
1 reply →