Colorful svn diff

October 30, 2012 at 18:32

Who doesn’t love colors in a terminal 😀 ? At least I do, so I usually have the following function defined in my bashrc file:

function svn {
        IFS=$'\n'
        if [ "$1" == "diff" ] ; then
                shift
                `which svn` diff --diff-cmd diff -x -uw $@ | colordiff
        else
                `which svn` $@
        fi
}

In case the first argument is diff, I invoke the svn command defined in the path specifing the diff command that I want to use. This includes some diff tweaks to ignore spaces and that kind of stuff, and also the colordiff command to give it a nicer look :). Also, the function can be extended to do special stuff with other svn commands.