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

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


1 badge earned


Participate in fun challenges

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


Gift kudos to your peers

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


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!


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
Community Members
Community Events
Community Groups

SourceTree external diff tool

The external diff tool in SourceTree (windows version) is not working at all. When system default is used, it tries to run vim.exe (presumably for vimdiff?), but nothing happens, vim.exe will just keep using the CPU resource until it's forced to terminate. Any other "out-of-the-box" tools I tried (kdiff3 and diffmerge) doesn't work as well. I tried looking at the sourcetree.exe.config, and found out that the difftool value is set to -1.

What is the correct way to setup a external difftool (and mergetool) for Window's SourceTree? Does it have to run under administrator privilege?

7 answers

1 accepted

3 votes
Answer accepted

'System default' means whatever you have configured in your .gitconfig already as your default diff tool. SourceTree doesn't change this one - it's there so that ST will by default just pick up anything you've already configured yourself - in your case you must have configured something to use vim at some point.

If you want SourceTree to configure a tool you should just be able to select the one of your choosing from the drop-down. I just tried Araxis, DiffMerge and KDiff3 here (I usually use P4Merge personally) and they all worked fine when I chose them. SourceTree doesn't run as admin, it runs as your own user but that should be enough to find things - when you pick a tool it searches for it by checking the registry (read-only) and also the common file locations (program files) - read only permissions should be fine.

If you still can't get this to work, please have a look at the .gitconfig file in your home directory, which is what ultimately gets used to open the external diff tool.

Thanks for the quick response.

1. Yes, I know the default is from git default. I didn't change anything for git diff, so it is vimdiff, and it works fine from gitbash.

2. I tried selecting kdiff3 and diffmerge, both doesn't do anything.

3. I just tried using the embedded git for sourcetree, still doesn't work.

I'm actually fine with using vimdiff, but the problem is it doesn't show up. It just loads the vim.exe in the background, and nothing else. So I figured I'd use something else, but it turns out they don't work.

I'm suspecting it is the sourcetree config that has problems. The "difftool" and "mergetool" setting in sourcetree.exe.config has a value set -1. Is this supposed to be the case?

  1. In that case it's probably a difference between the environment in Git Bash - anything you've set up there in your .profile etc, PATH, other environments, won't be visible when calling the difftool elsewhere. I've never used vimdiff though so I'm not sure of the specifics.
  2. Can you tell me where you have those tools installed, and whether they were installed via a regular installer or via something else like Cygwin which might not have registered them in a normal way in the registry? I have both tools installed here and they work fine, but I used their standard installers from their websites.

The value of -1 in the config is fine, it means 'System Default'. The SourceTree.exe.config alongside SourceTree.exe just defines the out-of-the-box settings, when you change any settings they get saved as 'user.config' under your %USERHOME%\AppData\Local folder (exactly where depends on which version you're using, the new installer puts them in Atlassian\SourceTree.exe_xxxxxx\versionno\user.config). So that's almost certainly not the issue.

I installed both kdiff3 and diffmerge using their regular installer.

I have cygwin, but I don't install vim there. In fact, the only vim I have is from git installation (under the share folder).

I tried to set gitbash to use kdiff as the difftool, works fine there, but still nothing from sourcetree.

Is there a path that I need to include or anything? If I were to uninstall git completely and use the embedded version, what will be the default diff tool?

Can I see your .gitconfig after you've configured kdiff yourself, and after you've configured it in SourceTree? ST actually creates an extra diff entry in parallel to your manually configured ones so we should just be able to compare them directly to see what the difference is.

    tool = kdiff3
    prompt = false
[difftool "kdiff3"]
    path = C:/Program Files (x86)/KDiff3/kdiff3.exe
    trustExitCode = false

    tool = kdiff3
    keepBackup = false
[mergetool "kdiff3"]
    path = C:/Program Files (x86)/KDiff3/kdiff3.exe
    trustExitCode = false

Those are the settings I used. AFAIK, there is no change after I set ST to use kdiff3.

Thank you. That fixed it for me. I changed the HOME variable some time ago for cygwin, totally forgot to change that back.

AFAIK, there is no change after I set ST to use kdiff3

That probably explains why it's not working. What you should see is something like this after you configure anything other than 'System Default' in SourceTree:

[difftool "sourcetree"]
	cmd = 'C:/Program Files/SourceGear/Common/DiffMerge/sgdm.exe' \"$LOCAL\" \"$REMOTE\"
[mergetool "sourcetree"]
	cmd = 'C:/Program Files/Araxis/Araxis Merge/compare.exe' -wait -merge -3 \"$LOCAL\" \"$BASE\" \"$REMOTE\" \"$MERGED\"
	trustExitCode = true
	keepBackup = false

The fact that you don't have any entries like that suggests that the .gitconfig you're looking at isn't the one SourceTree is using. For that to happen, your command line must see a different .gitconfig - are you changing your HOME directory or other home-related settings in your bash .profile or similar, which is therfore only visible to bash? SourceTree uses the following rules to locate your global git config:

  1. HOME, if defined in the global Windows environment (NOT in .profile or similar, only Bash sees that)
  2. HOMEDRIVE + HOMEPATH as a first fallback
  3. USERPROFILE as a last resort

This is where it will be getting its settings from.

I installed Kdiff3 and set SourceTree to use Kdiff, but that seems to launch a two-way merge only. One of the things I really liked about Kdiff, which comes out of the box with TortoiseHq is that you get three way diffs.

We had a similar problem; our .gitconfig had two 'cmd' lines in the [difftool "sourcetree"] block. Git/SourceTree appeared to use the last 'cmd' assignment in the block, which was for some reason set to an unrelated command.

I am using Mercurial. In SourceTree > Options > Diff I can not change the setting under 'External Diff / Merge' at all, all the fields are disabled.

I want to set Winmerge as my Diff/Merge tool, how can I change that setting?

Found it! The option 'Allow SourceTree to modify your global Git and Mercurial config files' was unchecked. Checking this option enables the fields on the 'Diff' tab.

@jvddrift: Thanks! This had me stumped! A little note under the disabled elements would be so helpful... but that seems to be asking too much.

Like jvddrift likes this

Yes, even after 7 years :-)

I've been trying to get this working with KDiff3, and nothing seemed to be working. I was trying it while I was looking at a stash, but after re-opening it once, I tried it from the File Status screen, and it worked. It still doesn't work from the stash view.

I haven't chased it down completely, but it seems like they only got it working from views where there is only one file. Since my stash had many files, maybe that's why it didn't work? Thought I'd share, in case anyone else is beating their head against this.

I'm using Sourcetree on a Mac with a Mercurial repository on Bitbucket. I'd like to get it working with BBEdit. Installed the command line tools (bbdiff) and it is working fine from the Terminal but it won't launch BBEdit. This video shows what is happening.

I tried to follow the instructions on how to edit the configuration files but it shouldn't be this difficult to get it working.

I also switched now to Git Extensions. This lock issue was now tip of the iceberg.

  • ST is getting slower and slower from my point of view. New fancy UI updates do not help here...
  • ST just does not understand when files are getting deleted in both branches (root cause of the issue mentioned in this thread) - GE has no issues with that fact.
  • Need for login etc. during installation - Everytime it takes longer / gets more complicated. 

Sorry, back in 2015, I really liked the tool and it helped me to get familiar with GIT...

Same here... I have selected non-system default options for the external diff and merge and the ST.config file remains -1 on both cases


I have the same issue : setting a diff/merge tool does not change the ST.config file. I have Tortoise Git installed, and I would like to use tortoiseGit Diff and Merge tools but no way...

I would preferer to avoid modifying the git config file if possible.

Did I miss something ?

Thanks :-)

Edit : When I set tortoise as tool, ST creates the merge file (in case of a conflict) (LOCAL, ETC...) but does not start any tool.

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events