The output of git diff is optimized for code which tends to be one statement per line whereas text can (if authors like me are too lazy to use line breaks) caus
The word-diff suggested in the other answer isn't exactly what gitlab/github do. To get same effect, you can use diff-highlight script that is distributed with git.
First find path to diff-highlight script. It varies between systems, and is not usually in $PATH. You can find it with your package manager, for example:
rpm -ql git | grep diff-highlightdpkg -L git | grep diff-highlightpacman -Ql git | grep diff-highlightEdit ~/.gitconfig, and add to the [pager] section the following (substitute the path):
[pager]
# diff-highlight is script provided by git that shows word-by-word diff
log = perl /usr/share/git/diff-highlight/diff-highlight | less
show = perl /usr/share/git/diff-highlight/diff-highlight | less
diff = perl /usr/share/git/diff-highlight/diff-highlight | less
I'm using perl here instead of calling the script directly because some distros, it seems, do not set executable bit on the script. IMO this is a package bug which should be reported. Anyway, this answer should work disregarding that.
Now log, diff, show commands should show difference word-by-word. Screenshot: