Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,456,659
Community Members
 
Community Events
176
Community Groups

shortcut to Sourcetree in Mac OS Finder

Is there an easy way to add a link to the Mac OS Finder toolbar that will open up SourceTree for the current folder (if it contains a git repo)? I've done this with Textmate and the terminal (shown below). The addition of a git GUI would complete the trifecta!

5 answers

It's simple to make an application with applescript and drop it to the finder toolbar.

on run
	tell application "Finder"
		set theFolder to (the folder of the front window as alias)
		if (exists folder ".git" of theFolder) then
			tell application "SourceTree"
				activate
				open theFolder
			end tell
		end if
	end tell
end run

But every time you get a "want to add to root" question.

Are there commandline options for SourceTree to just open a git folder?

The 'stree' command line tool will open the current directory or any paths it is given on the command line. You can install it using the menu option 'SourceTree > Install Command Line Tools' on the direct download version of SourceTree, or get the supplemental binary for the App Store version from here http://downloads.atlassian.com/software/sourcetree/SourceTreeAppStoreCmdLineToolInstaller.pkg

The command-line version:

on run
	tell application "Finder"
		set theFolder to (the folder of the front window as alias)
		if (exists folder ".git" of theFolder) then
			set theFolder to quoted form of POSIX path of (the folder of the front window as alias)
			do shell script "screen -dmS sourcetree-droplet bash -c \"cd " & theFolder & "; /usr/local/bin/stree\""
		end if
	end tell
end run

This still opens "Create Bookmarks?" window.

The command-line version:

on run
	tell application "Finder"
		set theFolder to (the folder of the front window as alias)
		if (exists folder ".git" of theFolder) then
			set theFolder to quoted form of POSIX path of (the folder of the front window as alias)
			do shell script "screen -dmS sourcetree-droplet bash -c \"cd " & theFolder & "; /usr/local/bin/stree\""
		end if
	end tell
end run

This still opens "Create Bookmarks?" window.

The command-line version:
on run
	tell application "Finder"
		set theFolder to (the folder of the front window as alias)
		if (exists folder ".git" of theFolder) then
			set theFolder to quoted form of POSIX path of (the folder of the front window as alias)
			do shell script "screen -dmS sourcetree-droplet bash -c \"cd " & theFolder & "; /usr/local/bin/stree\""
		end if
	end tell
end run

This still opens "Create Bookmarks?" window.

If you don't have a bookmark for the opened repo then yes, you'll get an option to create a bookmark.

Here is a good solution that contains an "Open in SourceTree" app that can be dragged and dropped in the toolbar of Finder:

36919049-f5c33b0e-1e81-11e8-9c70-424d2e9ff753

https://github.com/kdabir/finder-buttons

0 votes

In 1.3 if you right-click a folder in Finder and go to 'Services' there is an option 'Open In SourceTree'.

True, but three clicks are needed, droplet only one.

I would like to know this too...

GitX has one, maybe get the sourecode there to build one for SourceTree.

http://code.google.com/p/git-osx-installer/wiki/OpenInGitX

I would like to know this too...

GitX has one, maybe get the sourecode here to build one for SourceTree:

http://code.google.com/p/git-osx-installer/wiki/OpenInGitX

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events