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

Branch graph show wrong info after merge

lang qiu May 19, 2015

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.

 

CloudPhone__Git_.png

2 answers

1 vote
Balázs Szakmáry
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.
May 19, 2015

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.

Balázs Szakmáry
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.
May 19, 2015

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

Balázs Szakmáry
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.
May 19, 2015

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.

lang qiu May 20, 2015

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!

CloudPhone__Git_.png

 

Balázs Szakmáry
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.
May 20, 2015

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: http://git-scm.com/docs/git-merge to understand what is going on.

lang qiu May 20, 2015

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 ?

Balázs Szakmáry
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.
May 20, 2015

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

0 votes
Seth
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.
May 20, 2015

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 - jira.atlassian.com.

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

lang qiu May 20, 2015

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
TAGS
AUG Leaders

Atlassian Community Events