I was using NetBeans GIT plugin before, then I've decided to switch to SourceTree, as it is more efficient and powerful. As a newcomer to SourceTree I've managed to figure out basic Pull, Push and 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, but I 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 as this might help someone like me one day.
I know there are lots of people who have been using SourceTree for a long time. Could any of them 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)?
Under Branches, double-click the feature branch that is behind to switch to that branch. Click the Merge button. From the popup that appears, select the commit you want to merge into your feature branch. Check the Create a commit even if merge resolved via fast-forward option at the bottom.
Luckily, Git offers powerful tools to help navigate and resolve conflicts. Git can handle most merges on its own with automatic merging features. A conflict arises when two separate branches have made edits to the same line in a file, or when a file has been deleted in one branch but edited in the other.
I'm using SourceTree along with TortoiseMerge/Diff, which is very easy and convinient diff/merge tool.
If you'd like to use it as well, then:
Get standalone version of TortoiseMerge/Diff (quite old, since it doesn't ship standalone since version 1.6.7 of TortosieSVN, that is since July 2011). Links and details in this answer.
Unzip TortoiseIDiff.exe
and TortoiseMerge.exe
to any folder (c:\Program Files (x86)\Atlassian\SourceTree\extras\
in my case).
In SourceTree open Tools > Options > Diff > External Diff / Merge
. Select TortoiseMerge
in both dropdown lists.
Hit OK
and point SourceTree to your location of TortoiseIDiff.exe
and TortoiseMerge.exe
.
After that, you can select Resolve Conflicts > Launch External Merge Tool
from context menu on each conflicted file in your local repository. This will open up TortoiseMerge, where you can easily deal with all the conflicts, you have. Once finished, simply close TortoiseMerge (you don't even need to save changes, this will probably be done automatically) and after few seconds SourceTree should handle that gracefully.
The only problem is, that it automatically creates backup copy, even though proper option is unchecked.
There is an alternate solution to this problem, which uses KDiff3 instead of TortoiseDiff / TortoiseMerge.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With