How can I resolve a conflict on a file?

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

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.

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?

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

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".

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Oct 23, 2018 in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

1,207 views 4 2
Read article

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