How can I resolve a conflict on a file?

Johan E. Bengtsson October 26, 2016

This is pretty basic, but the user interface does not make obvious what to do. I did not use SourceTree much.

 

There is only a "master" branch. A file has a conflict on a single line. Trying to do either a Pull or a Merge shows the file, with two versions of the line (with + and - signs). Now what? I want to tell SourceTree to just pull the updated file from the repository, but how can I do that?

2 answers

0 votes
Johan E. Bengtsson October 27, 2016

Not sure how this got marked as "bitbucket-server", will try to ask again in the SourceTree topic.

In any case, I do not have a messed-up file, and selecting "reject hunks" (what does that really mean?), produces a .rej file with this content:

diff a/css/service.css b/css/service.css (rejected hunks)
@@ -1,6 +1,6 @@

body {
- background-image: url(../image/texture.png);
+ background-image: url(../image/texture_simple.png);
background-size: 100% 100%;
background-attachment: fixed;
}

Not too sure what "command line" you are talking about, I am a poor Windows 10 user, but would be completely OK running any command line to fix the problem, even under Cygwin. It is weird though, SourceTree is supposed to simplify and make visibile what I am doing, right?

Jobin Kuruvilla [Adaptavist]
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.
October 30, 2016

SourceTree doesn't do merge conflicts. You might find this discussion useful.

https://answers.atlassian.com/questions/156961

Johan E. Bengtsson October 30, 2016

Jobin, thanks for replying. I have resolved the issue. Summarizing for the benefit of anyone searching for how to handle this type of situation:

  • SourceTree allowed me to push a version that was conflicting with another version pushed by another developer. I think I received no advance warning, but not sure. The conflict was pretty trivial, but it blocked further work.
  • To select the good version to be the current one, I had to enable "force push" (in essence overwriting instead of merging). This was complicated, since SourceTree seems to think it is in my best interest to not have this option - but it is very necessary when stuck.
  • I had to update to the latest SoucreTree version to have the option of enabling "force push" - v1.9.6.1 has it under Tools... Options... Git.
  • Later on, I might look into automatic merge tools, but this was so trivial that it was not needed. In any case, I did not get a combined file that I could resolve manually either, only a .rej file with diffs after pushing the "Reverse hunk" button - I would have managed with that if there had been a need to do a manual merge instead of just selecting one of the versions.

I think I have now succeeded in tagging this question as "sourcetree" instead of "bitbucket-server".

0 votes
Jobin Kuruvilla [Adaptavist]
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.
October 27, 2016

SourceTree does not have a merge tool. You can use another merge tool like Meld and configure it to be used with SourceTree. You can do the same thing with command line.

Or you can open it in a simple text editor and resolve it yourself. In any case, merge resolution happens outside the Bitbucket Server.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events