search

Tuesday, December 9, 2014

bash: Colourful side-by-side command line diff

I have never liked default linux diff command. The more changes you make, the less informative it becomes. When you work with git it would be nice to have side-by-side comparison of original file and a new file with changes. Graphical tools like smartgit and meld do it really impressive.

But sometimes it is more comfortable to use command line tools. For colourful side-by-side git diff you can use cdiff. The simpliest way to install it is with pip package manager:
pip install cdiff

Then in your repository run:
cdiff -s

And the result is gorgeous!

The next tool is called icdiff. It does basicly the same, but with files. Install it with that command:
curl -s https://raw.githubusercontent.com/jeffkaufman/icdiff/release-1.2.0/icdiff \
| sudo tee /usr/local/bin/icdiff > /dev/null \
&& sudo chmod ugo+rx /usr/local/bin/icdiff


Use it like this:
icdiff file1 file2