Possible to enable the word-diff option in github to see more granular changes to a line? Possible to enable the word-diff option in github to see more granular changes to a line? git git

Possible to enable the word-diff option in github to see more granular changes to a line?


Github has changed their web pages over time to help users explore more ways of diffing their data.

At the time of your question, you were correct that you could secretly append ?w=1 to ignore whitespace.

Recently they added a control to the Pull-request page, where you can toggle whitespace without using commandline, see screenshot

Screenshot Github pull-request page 2018-08-21

However, (as you ask), it is probably unlikely that Github will add many, many diff settings that helps you differently depending on the context of your problem.

For instance git diff --word-diff may help you in your particular case because of the long lines. But it will give you problems with any +-{} characters, since they are not escaped.

Then you could use git diff --color-words, where you only get the differences in color (and no special characters are inserted.

As a third option you could also use git diff --word-diff-regex="." which will diff any single changed character (as opposed to the standard word breaks above.

I sometimes need to view XML file diffs, and sometimes they are concatenated to a single line. And in that case I can sometimes be lucky and normalize the files before and after. Git also has options for that. See git-attributes for examples involving smudge/clean

So, don't expect too many diff controls on a github page: The controls you may need vary too much to make sense in any usecase. Instead, use the command line