Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to resolve merge conflicts in sourceTree

David Newey May 8, 2015

I have a develop branch that I just committed files to. During the commit I got a pop-up that said there were merge conflict due to an earlier commit by another developer. Instructions in the pop-up said to go to 'Resolve Conflicts' and use those options. The only options I am given under Resolve Conflicts are 'Restart Merge' or 'Mark Unresolved' neither of which is an acceptable solution. How do i actually resolve merge conflicts?

2 answers

9 votes
Tim Crall
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.
May 8, 2015

You can resolve merge conflicts manually by opening the conflicted files in any editor.  The conflicts have been marked up like this:

<<<<<<< HEAD
// code from base branch
// code from merged branch
>>>>>>> branch1

You can then manually edit the code to contain one or the other or a synthesis of both changes and remove the markups.  Then stage and commit to complete the merge. 


Jayan Anuranga September 22, 2017


Like # people like this
nick t October 4, 2019


Like # people like this
Thomas_Britt November 12, 2019

I agree with nick t, that is no way to resolve conflicts.

Like # people like this
Kenneth Sizer January 9, 2020

Like "start walking West" to reach California, this is *a* way, but it would not be my first choice.

Like # people like this
gmonroe December 4, 2020

Not only does this seem like a clunky fix at best, it doesn't work.  I edit the file, and it just gives me the merge error again.

Ryan Daly February 5, 2021

Sourcetree seems to not care about merge conflicts. I know how to resolve conflicts by editing files. But isn't Sourcetree supposed to be better than this? There seems to be no interface for it.

Like micsun-al likes this
7 votes
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.
May 8, 2015

You have to configure SourceTree to use your merge software. In the Diff tab of the Options dialog, look for the Merge tool dropdown for a list of programs that SourceTree knows how to use out of the box.

Daniel Russell September 18, 2019

I don't understand where to see conflicts and what files need resolution etc. It's so confusing. Where do I click after I hit merge and get the dialog popping up saying to do so? Literally lost.

Like # people like this
David_Knoll May 1, 2020


Mariana Schiff May 14, 2020

The popup dialog after the merge leaves you in the middle of nowhere. It's not clear where to find the Options dialog.

After reading all the comments here and clicking around in the tool, I finally figured out a reasonable way to do this. Please note that this describes how I did it; it may look different for you:

  1. If you haven't set up an external merge tool:
    1. On the main menu, click on Tools -> Options to open the Options dialog
    2. On the Diff tab, in the External Diff / Merge frame, in the Merge Tool dropdown, select one of the available tools. If your tool is not listed, select Custom. In this case, you need to provide the correct arguments for your tool based on the cryptic note provided. I gather you need to surround each argument in quotes, and escape the quotes with backslashes.
    3. Click OK to close the Options dialog.
  2. In Sourcetree, after dismissing the popup that tells you that you have conflicts, click on the "Uncommited Changes" row of the tree.
  3. On the list of Unstaged files at the bottom, you'll find some that have an orange triangle icon with an exclamation sign in it. These are the files with conflicts. (Note that they are also listed in Staged Files, but they show no differences there.)
  4. Right-click on a conflicted file, and select Resolve Conflicts -> Launch External Merge Tool (of course, you could select one of the other options if it's that clear-cut).
  5. If you're lucky enough that your tool is launched correctly, perform your changes.
  6. Once you've performed the merge, save the file and close the external tool.
  7. Then you'll be able to commit your changes. In my case, they were already staged.

If you don't have a merge tool, you'll need to edit the files as explained below by Tim Crall.

Like # people like this
Allen Maizenberg February 1, 2021

exactly what i needed. thank you for adding

Pablo Oliveira July 1, 2021

Friend, what software are you using to diff externally? have indication

Mariana Schiff July 2, 2021

I use WinMerge, but there are other tools that would work as well.

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events