Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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:

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):

    tool = sourcetree
[difftool "sourcetree"]
    cmd = 'C:/Program Files/Perforce/p4merge.exe' \"$LOCAL\" \"$REMOTE\"
    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
Community showcase
Published in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

3,266 views 4 5
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