Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to resolve git conflicts in SourceTree

sanojbogoda
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 11, 2014

I was using NetBeans GIT plugin before, then I've decided to switch to SourceTree (v 1.9.4 ) as it is more efficient and powerful. As a newcomer to SourceTree I've managed to figure out basic Pull, Pushand Commit workflows.

However, I got stuck when there were file conflicts when merging with my friend's work. In NetBeans if there are any conflicts, the plugin suggest to resolve it in a popup and I just want to go to the conflict resolving interface and accept the correct code chunk by clicking a button. That was simple.

In SourceTree, there is something called External Merge Tool which didn't work well for me. When I right click on the file with conflicts, it just opened up two files side by side and there were arrows pointing left to right in the middle. There is a dropdown at the bottom of the screen to select the arrow direction.

I tried to use this interface to resolve conflicts for a long time but failed. It didn't fix the conflicts and merged two files.

As I searched through the internet I found that some people use external SourceTree conflict solving plugins to merge. Actually I'm little lost here. That's why I've decided to post this problem here.

Could you please tell me, how to resolve conflicts in SourceTree effectively?

Should I use an external plugin or should I use the External Merge Tool (if so, how can I use this)?

Please help me! Thanks in advance!

6 answers

2 votes
Rafael Nascimento Sampaio
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 13, 2015

One thing I wish source tree had was a UI way to solve merge conflicts, the guys at Tower implemented within Tower 2 a feature called Conflict Wizard (Tower2that helps solve conflicts right from the interface of Tower. I understand that not all conflicts can be solved like this (sometimes you may want content from both files not just one or another).

Screen

conflict-wizard_@1.png

Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 13, 2015

It's not so fancy, but you can resolve the conflict by right clicking and selecting "Resolve using mine" or "Resolve using theirs". Beyond that, feature requests are more appropriate for jira.atlassian.com, where they can be voted on by other community members, and assigned to developers.

0 votes
barathwaja November 14, 2018

Is there any implementation undergoing from SourceTree Team side for solving this merge conflicts from SourceTree itself? Similar to what GitHub Released today.

 

FYI, https://blog.github.com/2018-11-14-github-desktop-1-5/

Seth
Contributor
November 15, 2018

That announcement isn't saying what you think.

"The app will now inform you which files have conflicts, route you to your preferred editor to resolve them, list the conflicts that you still need to address, and show you when everything is resolved and ready to merge."

The gif shows a button that says "Open in Atom" right before they are able to edit the conflicts.

However, I've not actually used this feature. Is there something I'm missing that makes this any different from what SourceTree has been doing for years? (Besides informing you of conflicts before a merge - SourceTree doesn't do that)

0 votes
lalinden
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 12, 2016

The SourceTree tool do not face the quality of Bitbucket service, is slow, color sintax is ugly, interface is poor, and merge inject fu... %^%$#@#$$ (<<<<<<) in the code...

Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 12, 2016

Those are conflict markers. You have to resolve conflicts. All version control systems do this when a merge involves trying to combine different changes to the same line of code.

Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 12, 2016

Additionally, you can use any git client to manage your local clone of a Bitbucket repo. If you don't like SourceTree, quit whining about it and use something else.

0 votes
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 15, 2015

TLDR; I am not on Mac and have never used Filemerge. Others here might have, but FileMerge is much broader that Sourcetree, you'd be better off asking how to use it on a Mac forum. Some people here don't like it, but it's the only built-in, so you may have to install an application.

Long version:

I'm not familiar with the term "Microsoft helicopter", but your definition makes a lot of sense. And you're right - my answer is not useful.

There are two reasons for this:
First reason: The problem at hand has almost nothing to do with SourceTree. Sure, SourceTree launches the merge tool, but it does so in the exact same way as any other Git frontend will - including the Git command line.

Now, if you need to know how to configure a specific merge tool so that SourceTree launches it correctly - this forum is the perfect place to ask the question.

Second reason: The question depends on what tool you use, and that choice is incredibly subjective. It's essentially the same as coming onto this forum and asking what the best IDE is. Sure, many people here might have an opinion, but it isn't relevant to the forum, and there are already exhaustive lists and debates elsewhere on the internet.

Atlassian isn't the only one to avoid this: Here's GitHub's page on how to resolve conflicts. Summary: "Use your text editor" - even less helpful.

These questions make the folks at StackOverflow grumpy too, but they usually get good answers before the question get's closed. Here's a useful one.

So, step by step:

1) Choose a merge tool. Install it if necessary. I recommend anything that supports 3-way merge. A simple diff is insufficient for resolving merge conflicts.

2) Configure SourceTree to use your merge tool in Options > Diff > Merge Tool. If it's not a selectable option, search for an answer about how to configure your tool, or ask a new question.

3) Try it out. Every tool works differently, so hopefully you can find documentation, or possibly find it to be intuitive. If you can't make it work (Sounds like you can't make FileMerge work), go back to step 1.

0 votes
Harissa
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 12, 2015

I'm having exactly the same problem. I can do basic operations in Source Tree but as soon as I get a merge conflict I can't get anything further.

Thanks for your answer Seth but its a bit of Microsoft Helicopter answer - completely factually correct but no use at all. I'm not looking for a better merge tool. I'm looking for instructions on using any merge tool with source tree. Preferably a built in or default one so I don't have to worry about installing something new. I'm on a Mac and when I open "External diff" it comes up with something called FileMerge and I can't make it do anything - selecting "choose right" does nothing.

A step by step guide would be great.

0 votes
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 11, 2014

I'm not sure that there's actually a difference here. SourceTree does not have a built-in merge tool, so it uses an external one. You can allow to start the system's default merge tool, select from a list of supported tools, or enter the command line params for any non-supported tool.

Based on your SourceTree version (1.9.4) it sounds like you are on a Mac. Another Mac user recently expressed frusteration with the default tool. You might try a tool that supports 3-way merge (original, branch a, branch b). Meld sounds like it can do this, and it's free.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events