Information Technology Reference
In-Depth Information
Then, he fetches the remote branches from Sarah's repository as remote tracking
branches into his repository with
$ git fetch
. The command creates the
ori-
gin/master
remote tracking branch that is not related in any way to the local
mas-
ter
branch in John's repository. You can check it with
$ git branch -a -vv
.
The line concerning his
master
branch doesn't contain the
[origin/master]
part. It looks like:
* master
abc123f s2
It proves that it is still an ordinary branch because the local tracking branches con-
tain
[origin/master]
, as in:
* master
abc123f [origin/master] s2
Next John creates an ordinary local branch named
sarah
with:
# john's command run in 10-05/johns-repo
$ git branch sarah
and he configures his
sarah
branch as a local tracking branch for the
origin/mas-
ter
branch:
# john's command
$ git branch --set-upstream-to=origin/master sarah
To check the code written by Sarah in
s1
and
s2
revisions, John goes to the
sarah
branch with:
# john's command
$ git checkout sarah
The branch doesn't contain
s1
and
s2
revisions yet, as proved by:
# john's command
$ git status -sb
The output informs you that his current branch (
sarah
) is two commits behind its
remote tracking branch (which is
origin/master
). John updates his
sarah
branch
with: