Information Technology Reference
In-Depth Information
• remote connection: which remote branch is connected with this branch?
• send/receive: can I send/receive to/from this branch using a remote
branch?
You will notice in Table 5-1 that only remote tracking branches are permitted to in-
teract with remote branches. During cloning git automatically creates:
• One local tracking branch master 2
• Remote tracking branches for all remote branches
Therefore, right after the $ git clone command the repository 05-02 contains
the following branches:
* master
remotes/origin/HEAD -> origin/master
remotes/origin/doc
remotes/origin/info
remotes/origin/master
The above is the output of the $ git branch -a command. The line:
remotes/origin/HEAD -> origin/master
prints the contents of the .git/HEAD file of the remote repository. That's how you
would know which branch is considered current by the remote end.
Remember that the new repository created with $ git clone contains the com-
plete database—with all the revisions and other objects. Only the local pointers stored
in the .git/refs/heads directory are missing. You have to create them manually.
It can be done with the $ git checkout command. As with many other git com-
mands, the $ git checkout command is used to achieve a number of different
goals. In this recipe $ git checkout is used to create a new local tracking branch
for a remote branch with the same name. Thus the command:
$ git checkout info
creates a local tracking branch named info . This branch will be connected with the
remote tracking branch remotes/origin/info stored in your local repository.
After another command:
 
Search WWH ::




Custom Search