Last person who merges the code won't see changes made to his branch

lang qiu March 2, 2015

The problem is best illustrated by the following picture sourcetree.png

So we started with a common base, commit id 81109ae, then I did some change and my colleague did some change too. Then he merged my codes and continued with his work (commit 97cfed3). I continued to work on my own too (4103044).

Then I merged his code and have all of the latest code (commit a78cfd3)  So far so good. I can see what changes were introduced in this commit.

Then my colleague merged the latest code as well. His codes were also updated the latest codes. BUT sourcetree added just a label to that commit indicating his codes were also updated too. He can not see what changes were introduced into his branch, to be exact in his case, he can not see what I did commit 4103044 that merged into his codes base.

So is this a sourcetree problem or git ?

Thanks!

2 answers

1 accepted

1 vote
Answer accepted
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.
March 2, 2015

This is not a Git problem or a SourceTree problem, it is just the way Git works.

In the last paragraph, the merge was a fast-forward, i.e. no new merge commit was created.

If you read for example, this, hopefully you will understand better.

lang qiu March 2, 2015

Then how can my colleague see the changes introduced into his branch ?

 

Thanks!

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.
March 2, 2015

The merge was a fast-forward. This means that later commits (further up the same line) were merged into his workspace, but there is no merge commit, because there were no parallel changes. The moving of the branch flag and the changing of the working copy are the only things that happen. Please do read the docs, they explain this much better.

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.
March 3, 2015

In the future, your colleague can select the option to NOT fast-forward in the merge dialog.

lang qiu March 3, 2015

Hi thanks for the replies. So one last question, if he uses fast-forward and still wants to see the changes introduced, then if "git diff" the best tool he can use ?

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.
March 3, 2015

I think simply clicking through the commits that got merged is the simplest. (Unless they are very many.)

lang qiu March 3, 2015

Thanks. I have accepted your answer.

0 votes
lang qiu March 10, 2015

Hi I am afraid I have to bring up this question again. So red ones are my commits and blue ones are my colleagues'.

My last merge was a fast-forward and since there are several commits between 9957b17 and df1b868, clicking through them is not an effective way to changes introduced between my commit 79dbcee and 9957b17. So is there a better way to see the changes? I did use git diff but there were too many output from them, not easy to see change either.

Thanks!

 

CloudPhone__Git_.png

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.
March 11, 2015

You'll have to go to the command line. "git diff 9957b17 df1b868"

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.
March 11, 2015

You can output the diff to a file if you prefer to view it that way.

lang qiu March 11, 2015

I already did as I mentioned in my question but I was wondering was there a better/easy way ?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events