How to highlight SVN diff

By default Subversion shows diff without highlighting which makes a bit difficult review of big changes.

SVN

But that situation can be changed extremely simple and fast. I assume you use Fedora 17. For the other distributions you need just use different package manager, choose correct package name and find configs in the proper places.

First of all, install utility colordiff:
sudo yum install colordiff

Now you can get highlighted output of SVN diff:
svn diff foo.php | colordiff

SVN

But it isn’t convenient way. Since Subversion allows to use any external program to make a diff we just should just add following in the ~/.subversion/config:
diff-cmd = colordiff
And voilà, we can see colored diff just run ordinary SVN diff command:
svn diff foo.php

SVN

UPDATED:
To change colors in colordiff just copy its global config to your home directory and edit it:
cp /etc/colordiffrc ~/.colordiffrc
vim ~/.colordiffrc

Leave a Reply

Your email address will not be published. Required fields are marked *