It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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

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
Community showcase
Published in Sourcetree

Sourcetree for Windows - CVE-2019-11582 - Remote Code Execution vulnerability

A vulnerability has been published today in regards to Sourcetree for Windows.  The goal of this article is to give you a summary of information we have gathered from Atlassian Community as a st...

4,935 views 0 12
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you