How do I open a repository in SourceTree from the commandline (CLI) ?

Is there a simplified command that I can use to open a directory/repo in SourceTree ?

6 answers

1 accepted

This widget could not be displayed.

I've been using this:

open -a SourceTree /path/to/repo

It's better than nothing. You could make a bash alias for it--put this in your ~/.bash_profile:

alias sourcetree='open -a SourceTree'
Then you can do:
sourcetree /path/to/repo

this is simpler than that now, just install the command line tools and then run `stree /path/to/repo`

I'd like to directly open a commit (just like the "Jump to:" > "Commit..." menu). Is that possible somehow?

This widget could not be displayed.

Just install the command line tools, then you can do


stree /path/to/repo

It'll open the repo in source tree and ask if you want to create a bookmark for it

This widget could not be displayed.

Oops, I only read the description, I see you meant the Command-line, sorry.

Please see this issue:

That issue captures my request exactly - I've added comments in the feature request.

I won't close this question until the feature's implemented though :)

This widget could not be displayed.

[edit]please see the next answer regarding the command line - I'll leave this here anyway since it might be interesting to someone[/edit]

There are several ways:

  1. Drag & drop the repo folder from finder, either onto a place in the Bookmarks tree, or just on to the dock icon
  2. File > Open or Cmd-O
  3. There's also the 'Open Recent' menu, the contents of which also appear in Mission Control in Lion and on the dock right-click menu



This widget could not be displayed.

I installed SourceTree 1.3.0 from the Mac OS App Store, but I can't find the "SourceTree->Install Command Line Tools" menu item mentioned in the release notes. (And BTW, the release notes claim that 1.3.1 is available in the App Store, which doesn't appear to be the case.)

Unfortunately the App Store rules don't allow installers so we couldn't include it. You can, however get a standalone installer here:

The release notes are just relaying the fact that 1.3.1 in the App Store includes all the changes from Unfortunately Apple haven't approved the update yet, but we've submitted it.

This widget could not be displayed.

Thanks Steve. Worked a treat. Any chance of documenting this in the release notes for others' benefit?

Ah yes, it was in the release blog but not the notes, I'll add the link.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published May 30, 2018 in Sourcetree

Tip from the team: configuring Git or Mercurial in Sourcetree

Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...

874 views 2 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you