Setup Sourcetree to use Visual Studio Code as External Diff Edited

I'm using a Macbook Pro and have installed both Visual Studio Code (with command line) and Sourcetree.  I used sourcetree to setup the external diff tool.  And can confirm git is using it by going to a directory with changes and running "git difftool".  This will launch vscode diff on the files in the directory.  But whenever I right click a changed file in Sourcetree and select External Diff nothing happens.  I verified there are no other git config files by using:

find /my/home/dir -n ".gitconfig"

 

Here is my .gitconfig

[code]
editor = code --wait
[merge]
tool = sourcetree
[diff]
tool = sourcetree
[difftool]
prompt = false
[difftool "sourcetree"]
cmd = code --wait --diff $LOCAL $REMOTE
path =
[mergetool "sourcetree"]
cmd = code --wait $MERGED
trustExitCode = true

 

Is there some step I'm missing or something I did incorrect?

Screen Shot 2017-12-08 at 12.40.03 PM.png

1 answer

0 votes

Hi

I think its just a case of double dashes, --wait and --diff

I noticed that after I had changed to the full name when updating the pasted config.  I had -w and -d in the file itself but I do have --wait and --diff now.  Still same result as -w and -d.

I have also tried both embedded git and installed git.

Interesting it is working for me

I'll try completely removing sourcetree and reinstalling.  I already did the same for visual studio code.

Still not working after complete reinstall of sourcetree.  Followed these directions and even removed the app before starting over.

https://confluence.atlassian.com/sourcetreekb/how-to-wipe-sourcetree-preferences-412484640.html

No I don't think doing that to Sourcetree will change anything.

Playing around with it I followed the settings described here to get it working from the command line, then tried transposing them into the Sourcetree settings

https://stackoverflow.com/a/36644561/1297975

What does your .gitconfig look like?  I saw that article and don't see where mine is different.

Should the diff show under Command History?  Because it doesn't.

Ah, sorry my mistake I overlooked the fact you are on macOS. I'm on Windows.

I will have to try and reproduce it on there. Sorry for any confusion.

I made a simple little script to log the call and its not even logging anything.  Its as if sourcetree is not executing it at all.

 

/usr/local/bin$ cat code.sh
echo "Entered: " $@ >> /usr/local/bin/code.txt
/usr/local/bin/code "$@"

Have you been able to replicate on a Mac?

Hi 

Sorry for the late reply, no I cannot get it to launch on macOS at the moment. The Sourcetree setup and the manual setup in my config look the same, but while I can launch vscode via:

git difftool

I can't get it to launch via Sourcetree. I will pass it along to my macOS colleagues.

Suggest an answer

Log in or Join to answer
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

243 views 0 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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot