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

How to fix SourceTree's "External diff"? (no longer working)

matt_h March 27, 2018

Within the last week or two, SourceTree lost the ability to open the "External diff" tool: when I select External diff (or hit Ctrl-D), it no longer opens the external diff tool. Has anyone else seen this as well and/or does anyone have any pointers for how I might fix it?

I'm using Windows 10, SourceTree version 2.4.8.0 (latest, last I checked), and Source Gear's DiffMerge tool (version 4.2.0, which is probably old). I can open DiffMerge directly, even from the command line. Example:
"C:\Program Files\SourceGear\Common\DiffMerge\sgdm.exe" local.env local.env.dist

SourceTree is configured to use DiffMerge as the External Diff Tool and as the Merge Tool.

I looked at this Atlassian Community question, but it really seems to be about a different issue. (SourceTree on my computer is already allowed to modify the global git config.)

I tried changing the External Diff option to Custom and manually selecting the DiffMerge executable (C:\Program Files\SourceGear\Common\DiffMerge\sgdm.exe), with or without quotes, and passing the $LOCAL and $REMOTE as the parameters in the Arguments field in SourceTree (with quotes and with backslash-escaped quotes).

Any ideas? Thanks.

1 answer

1 accepted

2 votes
Answer accepted
Mike Corsaro
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 28, 2018

Hello! Could you do the following:

  • Open the Process Viewer (Tools > Process Viewer...)
  • Run the external diff command
  • Check the process viewer output and see if a command is run that looks like this:
    • git {STUFF} difftool -y --tool=sourcetree {SHA}^..{ANOTHER SHA} -- {THE FILE}"
  • If that command is showing up, try and then run it from the command line (just hit the 'Terminal' button in Sourcetree and paste the command in. You can save the process viewer log and copy+paste from there)
  • If that command is not running, could you post what is?

Thanks!

matt_h March 28, 2018

Hi Mike,

Thanks for your input. Yes, that command is showing up. Example:

git -c diff.mnemonicprefix=false -c core.quotepath=false difftool -y --tool=sourcetree 5e3db38^..5e3db38 -- docker-compose.yml

And here's the output:

/mingw64/libexec/git-core/git-mergetool--lib: eval: line 124: unexpected EOF while looking for matching `''
/mingw64/libexec/git-core/git-mergetool--lib: eval: line 125: syntax error: unexpected end of file

Any ideas? Thanks again,

- Matt 

Mike Corsaro
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 28, 2018

Sounds like the git config is corrupt. Open this file:

C:\Users\{USERNAME}\.gitconfig

 And look at the values under "difftool". Double check to see if there's anything odd, or if there's a missing ' or "

Like # people like this
matt_h March 28, 2018

Bingo! Sure enough, the difftool entry in the .gitconfig file had gotten corrupted somehow:

[difftool "sourcetree"]
cmd = 'C:/Program Files/SourceGear/Common/DiffMerge/sgdm.exe' \"$LOCAL\" \"$REMOTE\"
cmd = 'C:/Program
cmd = 'C:/Program
cmd = 'C:/Program
cmd = '/C:/Program

Removing all but the first entry there fixed the problem. Thank you! It's so nice to have my external diffs back.

Like anders_melander likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events