Git: Diff changes in a long line efficiently

Instead of showing you two lines for each change, Git allows you to highlight changes in a line explicitly:

git diff --word-diff some_file

Hello [-world-]{+universe+}!

(The result is usually colored nicely, the removed part being red and the added text green.)

When doing a diff on a long line, this can be very helpful but you'll still get a less-like scrolling output that can be unhandy to use.\
You maybe just want the diff put into your terminal:

PAGER='' git diff --word-diff some_file
Arne Hartherz over 9 years ago
This website uses short-lived cookies to improve usability.
Accept or learn more