the ultimate text diffing helper

I use Git not only for code, but also for text, my most common use case being co-authorship of scientific papers typeset in LaTeX.

While reviewing other author changes, the usual line-by-line diff is often annoying since:

  1. Paragraph re-formatting gets in the way (hello guys accustomed to compulsory Vim's gq or Emacs' M-q): it does not effect the final rendering, but it still hinders peer-review of changes.

  2. Even in the simplest case of a single word change on a single line, it will take some time for your eyes to spot where, along the line, the actual change is.

Stuff like wdiff does help, but I've never looked at how to integrate it with Git, and I still find it a pain in the eyes due to the fancy ASCII arts used to denote additions and deletions (pain that I usually experience when looking at the output of debdiff). There are nice diffing GUIs or editor-integrated solutions out there, but what I've always dreamed of is a plain old cmdline geekism.

Enter Git's --color-words, that can be passed to both show and diff commands. My favorite related Git aliases are as follows:

    [alias]
        wdiff = diff --color-words
        wshow = show --color-words

Here is a sample fancy output, yet very intuitive and console-based, of git show --color-words (text in red denotes deletions, text in green additions):

sample output of git show --color-words (screenshot)

Maybe not new to you, but it has been life-changing for me.