Branch graph show wrong info after merge

After merge, the master branch shows a graph I did not understand at all.

So I was at commit id 4255f88, the other guy merged my code and proceeded to commit id 647b2fd, then I merged his 647b2fd and get c3193e1. But the branch tree did not show the graph I expected (as I pointed here), instead it shows my latest commit id c3193e1 is merged from that purple one, which I have no idea at all where does it come from?!

BTW, here I chose "create a commit even fast-forward", but I had tried fast-forward either and got the same result.



2 answers

What it actually shows is that you have an unfinished merge (your uncommitted changes have two parents) between master and wp. Either finish or abort this merge before doing anything else.

Your screenshot shows that your last commit is c3193e1 (it is pushed) and that you are in the middle of an unfinished merge.

You do have uncommitted changes (the top line in the screenshot, with the empty grey circle on the left in the graph and "*" in the Commit column), which have two parents (the two grey lines coming from the empty circle). This means that you are in the middle of a merge. You can use the "Reset All" Option in the Discard dialog to abort the merge.

I stash the only 2 files remained (They never caused the problem before) The branch tree still looks weird. I do not have uncommitted change now but it still shows that purple line, which I have no idea where does it come from!



The highlighted commit is a merge, so it has two parents. (Why did you merge a commit instead of a branch?) You might want to read this: to understand what is going on.

I just clicked merge button and sourcetree popped up a dialog said "Pick a commit to merge into your current branch". This is what I always do when I merged others' codes and I nerve had a problem before till now. I just want to get rid of that purple line and let my latest commit shows it came from 647b2fd. What can I do now ?

Since your changes are already pushed to the server (imac/master is at the same commit), just leave it like this.

I've seen this before as well. Occasionally when I merge a branch into my own (I merge branches, not commits), SourceTree draws the graph such that the merge parent is some commit in the distant past that I can't find rather than the recent commit that is the head of the branch I merged.

I haven't been able to figure out how to consistently reproduce this or whether it's a bug in SourceTree or Git. It doesn't really have any impact on my workflow, so I just ignore it. If you want to file a bug -

As Balazs said, you've already pushed to origin, so there's not much you can do to fix it at this point.

Your words remind me that it may be a bug in SourceTree, so I checked my colleague's SourceTree to see if things show differently there. To my surprise it did and it shows what I expected!

git merge.png

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,100 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