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

How to merge with sourcetree git without command line

Ognian November 1, 2011

Hello I'm getting crazy finding out the workflow when merging and having conflicts. It is not that easy as it might seem...

After sourcetree shows up the dialog that I have to resolve manualy the conflicts, where is the window showing me the conflicting files? Where did I get a side by side view of the 2 versions. How can I mark a conflict resolved and how do I commit.

Thanks a lot

Ognian

2 answers

1 accepted

2 votes
Answer accepted
stevestreeting
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.
November 2, 2011

All conflicts will show up in the File Status view primarily (the first button on the tab control in the top-left, or Cmd-1). You can also see them if you select the 'Uncommitted Changes' line in the log view too, but the File Status view is the one that has the full functionality, particularly in Git where there's staging too.

The conflicted files are marked with an exclamation mark in a yellow triangle. You can see the diff on the right when you select the file, and you can see the diff against the two different parents by selecting 'Diff Parent' or 'Diff Merged' in the top bar of the diff area.

To resolve the conflicts, right-click a file and select Resolve Conflicts submenu (this is also available on the Actions top-level menu). There are lots of options in there, the most common one is the one at the top labelled 'Launch External Merge Tool', where you can launch the 3-way merge tool of your choice as set in Preferences (default FileMerge). Also in that menu are options for restarting the merge for that file if you do something unintentional when resolving, or to just accept one or other side of the merge, or mark things as resolved manually.

stevestreeting
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.
November 2, 2011

And committing is just done the usual way once you've resolved your conflicts, this is no different to committing usually.

Ognian November 4, 2011

Thanks a lot. I've set up a small testcase with 3 repositories a, b and c. b is a bare repository, and it is added as remote to a and c. So I'm able to simulate 2 developers working in their local git repos a and c and syncing to b.

Whe I simulate now a merge conflict by commiting one file with different lines in both local repos push on one side and try to resolve the merge conflict on the other side, as you explain I can see the confilict in the File Status View.

I can switch between dif parent and dif merged But even when starting the external diff tool I do not see side by side the change on one side and on the other side. What I see is the change on one side and a textual diff on the other side. Or to better explain if I changed in the a repo the line to

aaaaaa

and on the b repo to

bbbbbb

I see eighter

aaaaaaaa

and

<<<<<<< HEAD

bbbbbb

=======

aaaaaa

>>>>>>> 11a5f2ae21e4c60fbdc6d7436b9c38bd088cd8d7

or
bbbbbb
and

<<<<<<< HEAD

bbbbbb

=======

aaaaaa

>>>>>>> 11a5f2ae21e4c60fbdc6d7436b9c38bd088cd8d7

BUT NOT

aaaaaa

and

bbbbbb

what I would expect

What am I doeing wrong??

stevestreeting
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.
November 6, 2011

The 'chevron' markers are the standard notation when displaying conflicts within a file. To resolve this in a nice side-by-side view, right-click the file and select 'Resolve Conflicts > Launch External Merge Tool', which by default will be FileMerge.

Alternatively, some people like to resolve conflicts just by editing the file. The chevron markers show you the conflicts and from which version they came from, you can (if you want) just edit the file directly to merge the contents (removing the <<<< >>>> ===== markers). But the external merge tool is more friendly.

0 votes
shahzadkhan February 11, 2015

Once the unresolved icon shows on the file, right click on it >> "Resolve Conflicts" >> "Launch External Resolve Tool".

I really like P4Merge tool which you can download for free. Once you install it, go into SourceTree Tools menu >> Options >> Diff tab (2nd from left). It should not show up as an of the drop down option for 'Merge Tool', select that.

Now when you could just use P4Merge tool from SourceTree and it will shows you all the changes side by side. You can use any of your favorite merge or difference tool for your SourceTree managed files in the same way.

I might add once I run the merge tool and exit from there, SourcTree marks the file as merged even though If I had choosen not to save changes (equal to cancelling). I had to manually mark the file unresolved to be able to redo the merge.

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events