How to do diff like `git diff --word-diff` without git on Linux?

The result of git by git diff --word-diff is great. But how to do diff like git diff --word-diff without git on Linux? The plain diff command on Linux seems not accept options like --word-diff.

related to an answer for: Git diff with long lines
asked Oct 25, 2015 by anonymous

1 Answer

The wdiff is for word-diff:

wdiff program is a front end to diff for comparing files on a word per word basis. A word is anything between whitespace.

$ wdiff file1 file2

Bonus: colordiff is a wrapper for 'diff'. colordiff is written in Perl and produces the same output but with pretty 'syntax' highlighting.

$ wdiff file1 file2 | colordiff


$ wdiff file1 file2 | colordiff | less -R
answered Oct 25, 2015 by Eric Z Ma (44,280 points)

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost