How to do a merge in SourceTree from develop to feature branch without trashing all the conflicted files?

We are using SourceTree and GitFlow, and when I merge from "develop" branch to my feature branch, whenever there are conflicts, the conflicted files get both the mine and their content injected into the files, ruining all my conflicted files. Isn't their a way to configure it to offer me the oppertunity to merge the files with a built-in diff based merge tool, without me having to manually clean up all the messes it makes in my files?

I am used to using SVN with the Subversive plugin in Eclipse, and all I had to do was synchronize, it would show me the conflicted files, and I would double-click on the first one, and it opened it in a merge tool that allowed me to skip to each conflict and merge them one by one, resolving the conflicts by clicking an arrow between the two diffs - EASY!!!

Your default method instead trashes all my files, and I am forced to delete all those ">>>>>>" and "<<<<<<" strings you inject into my files manually. There has GOT to be an better way...

1 answer

SourceTree hasn't trashed anything, those <<< >>> are standard conflict markers that both git and hg (and svn and cvs before them) use when there changes that overlap and can't be resolved automatically. The merge has already been run on these files, the only reason the chevrons are there are to show where the conflicts are.

Some people like to edit the conflicts manually, but most people just right-click on the files and use the sub-menu 'Resolve Conflicts' to resolve the conflicts either with your external merge tool (ST supports many, see Preferences > Diff), or by just taking one or other side of the merge, for example.

Edit: To clarify, it's just the extra step of using the Resolve Conflicts > Launch External Merge Tool that you're not used to, but SourceTree is just a bit more flexible in how you resolve your merges rather than assuming you'll always want to use an external tool. In particular the file-level 'Restart Merge' feature can be very useful if you accidentally screw up your visual merge and want to start again without re-merging everything (resolving all the other files you've already done).

Thanks for taking the time to respond to my question. My followup question is, what is the proccess / proceedure in SourceTree to merge the files graphically, such that when I pull from develop branch to my feature branch, my files don't have to be manually edited (highlighting, deleting, etc.)? When I used to synchronize in eclipse with svn or perforce plugins, it was all so seemless. I was alerted which files had conflicts, and I could go into those files in the built in merge tool and using the icons, select which changes to keep and which to remove - easy!! I have searched and searched SourceTree, and cannot find how to configure SourceTree to help me do this. Suggestions on how to prevent use SourceTree to merge my files with a similar merge tool would be much appreciated...

Hi Tim. We rely on external tools for resolving merge conflicts because amongst other things, they're designed to do this. With such a high focus on this kind of functionality the external merge tools are excellent for handling conflicts. For this reason we only offer to either choose either 'mine' or 'yours' or launch an external merge tool. I've used many of the external merge tools and I would highly recommend them.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted 13 hours ago in Agile

What is Scrum? A good, bad, and ugly answer.

In a world of dark-scrum, faux-scrum, and scrum-butt, the question still remains: What is scrum and how do you do it “right?” That’s the question we set out to answer. I'm Max, I've been teaching c...

56 views 0 1
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you