Friday, November 18, 2011

Opening SourceTree from the command line

I've recently started using SourceTree to visualise and manage my git repos. It's very impressive.

The one thing I missed from gitx was the ability to launch SourceTree from the command line, in any directory of the repo. One solution is to set a git alias:

git config --global --add alias.sourcetree '!open -a SourceTree .'

and add an alias in the shell profile:

alias st='git sourcetree'

Now I can issue "st" from the command line and the relevant SourceTree window opens up.

(Thanks to Chris Frost for providing part of this solution.)

2 comments:

  1. Just to let you know, from 1.3 we have an in-built command line tool which you can use so you don't need to do this any more. :)

    ReplyDelete
  2. Nice! thanks Steve.

    ReplyDelete