git diff with color words

I had these files with very very long lines of text on each line. It was paragraphs worth of words but not word wrapped. These files were stored in a git repository. Now and then, someone would change a word. Diff with line based output was difficult to find what actually changed.

I figured there must be a way to see just the words. A little searching around the docs and I found it.

> git diff --word-diff=color

Perfect. I still got ling scrolling lines though. You can override that with your $GIT_PAGER variable or I just piped the output manually for a one time fix:

> git diff --word-diff=color | less -r

Much easier to see the changes!

This entry was posted in Programming and tagged , , , . Bookmark the permalink.