Information Technology Reference
In-Depth Information
How pushing affects the tracking branches
How do we update the remote branch master in shared-repo and the remote track-
ing branch origin/master in Sarah's repository? This is done when Sarah pushes
her commits with the $ git push origin master command. This command
changes the state of the two repositories as shown in Figure 10-15 . Figure 10-15
presents the results of executing $ git push origin master in sarahs-
repo in the state shown in Figure 10-14 .
Figure 10-15 . The state of the repositories from Figure 10-14 after the $ git push origin master command executed
in sarahs-repo
You should notice that to decide which revisions should be sent, git has to find only
the difference between the two branches master and origin/master in Sarah's
repository. Thanks to the two dots discussed in Recipe 7-2 this can be done with the $
git log --oneline origin/master..master command. This command
prints the list of revisions that are included in the master and excluded from ori-
gin/master .
Hint Please remember that remote tracking branches, such as origin/master ,
can be used in git commits in the same manner as ordinary local branches. For example,
the command $ git branch foo origin/master 3 creates a new ordinary
local branch named foo that points to the same revision as the grand-grand parent of
origin/master .
 
 
Search WWH ::




Custom Search