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

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

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.

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

 

Thanks!

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.

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

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 ?

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

Thanks. I have accepted your answer.

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

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

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

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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

798 views 0 4
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