Tomáš Zato
Tomáš Zato

Reputation: 53317

Sourcetree does not launch Beyond compare external merge tool

Suddenly, when I try to launch "External merge tool" from Sourcetree, the tool does not appear. I say suddenly, because it worked last time I tried. The dialog remains forever:

image description

Eventually I found this process related to the visual merge (dunno how to copy the command line from windows task manager):

image description

This process, by the way, does not disappear when I press abort, so somebody probably didn't do their homework. Actually, I wouldn't probably notice it if there wasn't six same processes with this command line.

These are my settings:

image description

How do I fix this? I need to merge project and I don't know what to do...

Upvotes: 9

Views: 13984

Answers (6)

Doctor Jones
Doctor Jones

Reputation: 21674

In my case, this was caused by being unable to locate the .gitconfig file. This is a problem, because the .gitconfig file is where the diff and merge settings are stored.

This is because it uses %HOMEDRIVE%%HOMEPATH% to locate it (which is usually C:\Users\%USERNAME%). In my case, this was on a work machine, and they were set to P:\.

While away from the office, my P: drive is unavailable, so it was unable to locate my .gitconfig file as P: didn't exist. Until our company's IT support team is able to provide me with a solution, I worked around this by mounting \\localhost\C$\Users\%USERNAME% as my P: drive, as I'm unable to change the values of %HOMEDRIVE%%HOMEPATH% myself.

(It would be much easier to diagnose if Sourcetree actually gave an error message about this, instead of silently failing)

See the following Atlassian Knowledge base article for more info.

Upvotes: 0

atm
atm

Reputation: 1783

The issue for me was that I still had the Merge Tool listed as System Default. Changing that configuration also to be DiffMerge seems to have solved it:

DiffMerge

Upvotes: 4

Lonzak
Lonzak

Reputation: 9816

The problem in my case was that I selected the tool itself but not the path to the tool. This seems to be mandatory: enter image description here

You can also see this in your '.gitconfig' file (located in the user directory):

Before

[difftool "sourcetree"]
    cmd = '' \"$LOCAL\" \"$REMOTE\"
[mergetool "sourcetree"]
    cmd = '' \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"

After

[difftool "sourcetree"]
    cmd = 'C:/Program Files/P4Merge/p4merge.exe' \"$LOCAL\" \"$REMOTE\"
[mergetool "sourcetree"]
    cmd = 'C:/Program Files/P4Merge/p4merge.exe' \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"

Upvotes: 0

Paiman Roointan
Paiman Roointan

Reputation: 574

In an addition to Tomáš's answer, you can run the following command in a command prompt in windows, to be able to answer the question git-mergetool asks when one of the files (or even both) is deleted.

Use your own CONFLICTED_FILE_PATH, and you may need to use a different path to point to your git-mergetool:

sh "c:\Program Files\Git\mingw64\libexec\git-core\git-mergetool" -y --tool=sourcetree -- CONFLICTED_FILE_PATH

Upvotes: 0

maxwell
maxwell

Reputation: 4166

If you cannot start the Sourcetree external merge tool, you can use this:

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

Upvotes: 0

Tomáš Zato
Tomáš Zato

Reputation: 53317

I found out that this happens when one of the files to be merged has been deleted. In that case, git prints out a command line prompt which sourcetree cannot handle. The git process then ends up hanging forever.

Best way to handle this is to kill the hanging git process and then make the choice manually using use mine/use theirs.

Upvotes: 13

Related Questions