SourceTree fails to start merge tool, possibly because it corrupts gitconfig

Balint Nagy February 12, 2019

I try to use SourceTree with P4Merge, but I always had issues with it (merge tool sometime starting sometime not). I searched SourceTree fails to start P4merge many times, without much result.

So I tried it with KDiff3 instead - but the results were the same.

I searched SourceTree fails to start merge tool, and found this: https://community.atlassian.com/t5/Sourcetree-questions/Launch-external-merge-tool-does-not-actually-launch-anything/qaq-p/11193

It gave the idea to look at the .gitconfig file, which seems to show the source of the problem: my .gitconfig is corrupted:

[difftool "sourcetree"]
    cmd = 'C:/Program Files/Perforce/p4merge.exe' \"$LOCAL\" \"$REMOTE\"
    cmd = 'C:/Program
    cmd = 'C:/Program
    cmd = 'C:/Program
    cmd = 'C:/Program
    cmd = 'C:/Program
[mergetool "sourcetree"]
    cmd = "'' "
    trustExitCode = true
    cmd = 'C:/Program
    cmd = 'C:/Program

I never used any tool other than SourceTree to change my diff and merge tools, so I think I can safely say that SourceTree corrupts the .gitignore file when I use SourceTree / Tools / Diff / diff and merge configuration (with the slight chance of some other tool's installer doing it).

 

1 answer

0 votes
Balint Nagy February 12, 2019

I managed to fix it by changing .gitconfig to look like this (other parts of .gitconfig not included):

[diff]
    tool = sourcetree
[difftool "sourcetree"]
    cmd = 'C:/Program Files/Perforce/p4merge.exe' \"$LOCAL\" \"$REMOTE\"
[merge]
    tool = sourcetree
[mergetool "sourcetree"]
    cmd = 'C:/Program Files/Perforce/p4merge.exe' \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"
    trustExitCode = true

et voilá!

I have a working merge tool in SourceTree!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events