Paged, colored svn diff

svn diff $* | colordiff | less -r
I put this in a shell script called "svndiff", as it provides a handy decorated "svn diff" output that is colored (which you can't see here) and paged. The -r is required so less doesn't mangle the color codes.
Sample Output
Index: foo/screen.cpp
--- foo/screen.cpp      (revision 5293)
+++ foo/screen.cpp      (working copy)
@@ -907,6 +921,10 @@
 void SetScreenSize(unsigned int width, unsigned int height)
+   if (width >= 132)
+      termWidth = screenWidth = 132;
    screenHeight = height;
    gs_bScreenSizeChanged = true;

By: introp
2009-02-18 16:19:08

What Others Think

Not surprisingly, colordiff (which is a perl script) is packaged under debian/ubuntu (and likely the same in other linux distributions) as the package 'colordiff'. Also, I use less in my similar version of svndiff() with the -S option so as to allow long lines to extend off the screen rather than being wrapped. Cheers.
bwoodacre · 633 weeks and 6 days ago
On RHEL, cdiff is the command
unixmonkey3371 · 628 weeks and 5 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: