View Local SVN Diff in TextMate

Posted in: Development

I created the simplest of little bash functions that I use just about everyday. All it does is:

  1. Save the output of the SVN diff command of the current directory in a temp file.
  2. Open that temp file in TextMate, which does beautiful color coding of the diff for easy review before I check in.1

That’s it.

It’s very easy to set up. Edit your .profile file to add the following line:

diffit () { svn diff > ~/Desktop/temp.diff; open -a TextMate ~/Desktop/temp.diff; }

Now open a new terminal window, navigate to an SVN checkout directory that has local changes, and type ‘diffit’ - the command you just defined. You should see the SVN diff results in TextMate, and saved in a temp.diff file on your desktop.

  1. Now that I think about it, I need to take the time to get Araxis Merge set up to see how it handles .diff files. Also how well its SVN tools work. [back]

Popularity: 11% [?]

Posted September 16th, 2007 @ 8:26 PM

3 Replies

  1. Adam Jacob Muller adds this Comment:

    You need the “mate” command installed for this, but if you don’t already have/use mate installed you should install it (Help / Terminal Usage).

    It’s quite a bit simpler, and avoids the potential race condition! (I multitask!)
    diffit () { svn diff |mate -a -; }

    September 17th, 2007 at 11:54 pm

  2. Adam Keys adds this Comment:

    @Adam right on, my alias looks basically the same:
    alias sdm="svn diff|mate"

    Also, just to tweak my ego, I’ve got one for running diffstat on my work: alias sdstat="svn diff|diffstat"

    September 18th, 2007 at 5:45 am

  3. Traffic King Pro adds this Comment:

    Hey! that command is really great and amazing. I too know little bit of programming but was confused.

    September 19th, 2007 at 5:00 am

Add a Comment

Please note: Use of a non-personal web site or blog in the field below and/or comments that are off-topic, personal attacks, or support requests will likely be removed at my discretion.

Note: This post is over 11 months old. You may want to check later in this blog to see if there is new information relevant to your comment.

Arrr! » « Around the web

About This Site

This is the personal web site of Alex King, an independent developer based in Denver, Colorado USA. More...


Crowd Favorite

Crowd Favorite is my software and web development business.

We build web applications, design and develop custom WordPress themes and plugins, and build custom sites using WordPress as a CMS.


I also have a tumblog that aggregates my online content from other services (Twitter, Flickr, del.icio.us. etc.).

Ads