Using colordiff and the Subversion CLI

A guide on how to use colordiff to achieve coloured diffs on the Subversion CLI

My policy is to use the CLI interfaces of version control systems whenever possible, as this means I can move from computer to computer and still be productive without worrying about what version control clients are installed there. As I am running diffs before I commit anything to Subversion or Git, it is kinder on my eyes to have them coloured in order to highlight the code changes. This can be achieved using the colordiff command in Linux.

Before we begin, make sure you have that command installed:

$ yum install colordiff

To run a regular diff using the Subversion CLI, I ran the following command to get this output:

$ svn diff view/renderers/html/AlphaRendererProviderHTML.inc

Now let us try that again, only this time piping the output from svn diff to colordiff:

$ svn diff view/renderers/html/AlphaRendererProviderHTML.inc | colordiff

I think you will find that the colours will really help while scanning through your diffs.

John Collins

I have been writing about web technology and software development since 2001. I am the developer of the Alpha Framework for PHP, and the five.today personal productivity app. I love open source, technology, and economics.

Installing Ansible on Linux

Git concepts simplified

Developing off the Alpha trunk