Each version ("commit") stored in git forms part of the graph, and it is often useful to think about what you do in git in terms of this graph.
When UserA starts, let's say that only two commits were created, which we will call P and Q :
P
He then modifies FileA, the steps that change, and creates a commit that represents the new state of the source code β say, commit is called R This has one parent, which is a Q commit:
P
After successfully clicking, the commit graph for the GitHub repository looks the same.
UserB started with the same story:
P
... but created another commit called S , which has its modified version of FileB:
P
UserB tries to click on GitHub, but the click will be rejected - unless you "push" push, you are not allowed to update the remote branch, unless your version includes the entire history on this remote branch server. So UserB pulls out of GitHub. The tension really consists of two steps, sampling and merging. Retrieve origin/master updates that are similar to the status cache of the remote master branch from the remote origin device. (This is an example of a "remote tracking branch".)
P
The story in this column diverges, so the merge tries to combine the two stories by creating a merge (for example, M ), which has both S and R as parents, and, we hope, represents the changes from both branches:
P
When GitHub shows you a diff that represents the changes made by the commit, it is simple if it is committed with a single parent - it can just run the diff from this version. However, in the case of a commit, such as M , with multiple parents, it must select a parent to show diff. This explains why the diff shown for fixing the merge M may seem the same as that shown for one of S or R Entries in git are determined by the exact state of the source tree, and not by the changes that the tree received in this state.