Last Updated: February 25, 2016
·
2.662K
· magnetikonline

Add some color to your diff output

Recently I have needed to mess with Subversion to get some day to day work done and probably the biggest gripe vs. Git (apart from obvious branching issues) has been the lack of color output when viewing diffs.

Picked this up along the way, pipe the patch file output of svn diff into vim, like so (as an alias):

alias svndiff='svn diff -x --ignore-all-space | view -c ":set filetype=diff" -'

set filetype=diff ensures vim treats what input it gets as a patch (sometimes it gets the auto-detect a little wrong I have found).

Added bonus, you can easily browse/search the patch with the usual vim controls. Of course variations on this pro-tip should work with anything in your utility belt that outputs patch files.

2 Responses
Add your response

Git diff has color git diff --color=always. Likewise you can use vim as the diff tool (shameless plug) http://www.youtube.com/watch?v=hb5RVnOda2o&feature=plcp

EDIT: It seems I misread the post as if git was the one lacking color

over 1 year ago ·

@shawncplus lol - all good :D thx for the vid, will check it out!

over 1 year ago ·