Information Technology Reference
In-Depth Information
To summarize, pushing updates the branches in the following way:
• In the local repository remote—the tracking branch is updated to the most
recent revision in the local tracking branch
• In the remote repository—the remote branch is updated to the most recent
revision in the local tracking branch
What happens if the push operation fails? If John executes
$ git push origin
master
in his repository as shown in
Figure 10-9
,
then the push is rejected with the
following message:
! [rejected]
master -> master (fetch first)
and all the branches remain unchanged.
How pulling affects tracking branches
This time we are watching the change from John's perspective. Therefore
johns-
repo
is the local repository and
shared-repo
is the remote repository.
When you pull from the remote repository, then your local tracking branch and re-
mote tracking branch are updated. The remote branch remains unchanged. The first
case (without a merge) is depicted in
Figures 10-16
and
10-17
.
Figure 10-16
presents
the state just before a pull operation. The shared repository contains two revisions
b1
and
b2
that are not included in
johns-repo
. The pull operation brings these revi-