Read more

Git: Diff changes in a long line efficiently

Arne Hartherz
February 24, 2012Software engineer at makandra GmbH

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+}!
Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

(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
Posted by Arne Hartherz to makandra dev (2012-02-24 17:42)