Windows
Adapting from multiple answers here for Windows, these scripts will allow you to get SourceTree running from command line (tested on SourceTree 3.0.1.7 / Windows 10).
Scripts in a PATH directory
I've placed both these scripts in a folder that is in my system PATH. You won't have to modify your bash profile for this script.
Git Bash for Windows
Create a file named stree
(touch stree
) in your PATH linked directory and run chmod u+x stree
on this file.
#!/bin/sh
function towinpath {
{ cd $1 && pwd -W; } | sed 's|/|\\|g'
}
if [ -z $1 ]; then
stree_path=$(towinpath pwd)
else
stree_path=$(towinpath $1)
fi
$LOCALAPPDATA/SourceTree/SourceTree.exe -f $stree_path log &
You can replace "log" in the last line with "status" if you prefer the changes/working directory view of your repository in SourceTree.
Command Prompt or Powershell
Create a file named stree.cmd
in your PATH linked directory.
@echo off
start "" "%LOCALAPPDATA%\SourceTree\SourceTree.exe"
Note that this won't actually open up the directory as a repository.
Please feel free to improve the scripts, especially the one for Command Prompt.