This feature was introduced in Gitlab 8.10 (see section "Inline Diffs").
git
itself uses line-based diffs, so it will internally always store the complete changed lines. However, git tools also allow to visually highlight only those changed parts, e.g. with git diff --word-diff=color
.
Edit
What Gitlab 8.10 introduces are additional highlights in changed lines. I.e. the complete changed lines will be highlighted with a light green/red, and the actual changes within a line will be highlighted with a darker green/red.
This is what you see in your figure:

and in the figure of Gitlab's release notes:

Apparently, Gitlab highlights the largest part of the line that contains any changes. It does not try to produce minimal changes, probably due to performance reasons.
The git --word-diff=color
option (including gitk
's Markup words
and Color words
setting) do produce fewer highlights. Compare Gitlab's diff:

with the same diff from gitk
:

However, even --word-diff=color
will—as the name suggests—only highlight on a word-by-word basis. For your example, it will simply highlight both words. Here is your case reproduced in gitk
with Color words
:

For the command line tools (e.g. git diff
), there is actually an option --color-words=.
that will do what you want:

However, neither gitk
nor Gitlab know this option, as far as I know.