Information Technology Reference
In-Depth Information
$ cd git-recipes
$ git clone --bare 05-01 05-13
$ cd 05-13
The newly created clone will be a bare one. List all the branches with the
$ git
branch -a
command. You will get the output:
doc
info
* master
As you can see, in a bare repository local branches are created for all remote
branches. You don't have to manually check them out as we did in Recipe 5-2. The
HEAD
reference points to the
master
branch—we know this, thanks to an asterisk in
front of
master
in the above output. But you can verify it with either of two com-
mands:
$ cat HEAD
$ git symbolic-ref HEAD
To change the current branch, execute the following command:
$ git symbolic-ref HEAD refs/heads/info
After this, the command
$ git branch
outputs:
doc
* info
master
Therefore, we know that the current branch was changed. If you are in doubt, you
can always double-check it with the
$ git log --oneline -3
command. It will
print the
i3
,
i2
, and
i1
commits.
How It Works