svndiff

Just a small productivity tip today. I have this in my .alias file (or put it in your .bashrc or somewhere).

svndiff () { svn diff "$*" | colordiff | less; }

When you now run svndiff where you would normally run svn diff you get a nice diff in colors (which is pretty addictive) and it uses less as a pager, so no need for the | less anymore…

8 Comments

  1. Inspired by “git diff”?
    Thanks for sharing, somehow I did not think that far until today.

  2. At least for coloring you don’t need an alias:

    Edit your ~/.subversion/config and set

    diff-cmd = colordiff

    And don’t you need less -r for coloring to work?

  3. Christoph Bartoschek

    I prefer diff-cmd=kdiff3

  4. You might also consider this ;)

    svn() {
    if [[ $1 == "diff" ]]; then
    /usr/bin/svn "$@" | colordiff | less
    else
    /usr/bin/svn "$@"
    fi
    }

    this way it’s quite transparent ;)

  5. @Flameeyes Ah, nice to hear from you again! And indeed your version is better. Adjusted my .alias….

  6. Oh, nice.

    I currently have:

    function svnless() { svn diff $@ | vim – -R }

    but i beleive yours will be faster :)

  7. Color did not work for me with less. Adding the following line before your or Diegos lines did the trick:

    alias less=”less -R” # Enable colors in less.

  8. I have something similar for some years now.

    Only I use vim to display the diff…