Information Technology Reference
In-Depth Information
The new repository contains only one branch named
master
. You can verify it
with the
$ git branch
command. Its tip is stored using loose format in the file
.git/refs/heads/master
. To create a branch named
info
that will correspond
to the branch with the same name in the cloned repository, execute the following com-
mand:
$ git checkout info
The command will print the message that the branch
info
is set up to track a re-
mote branch:
Branch info set up to track remote branch info from
origin.
Switched to a new branch 'info'
After the above command the repository will contain two branches:
master
and
info
. It can be verified with the
$ git branch
command.
In the same manner you can create the branch named
doc
:
$ git checkout doc
The repository
05-02
now contains three branches
master
,
info
, and
doc
.
Finish the recipe creating branches
foo
and
bar
:
$ git checkout -b foo master
$ git checkout -b bar master
The command
$ git branch -a -vv
outputs the following information:
* bar 7c9bc41 m3
doc 23d9855 [origin/doc] d3
foo 7c9bc41 m3
info 0d6501b [origin/info] i3
master 7c9bc41 [origin/master] m3
remotes/origin/HEAD -> origin/master
remotes/origin/doc 23d9855 d3
remotes/origin/info 0d6501b i3
remotes/origin/master 7c9bc41 m3