Information Technology Reference
In-Depth Information
$ git checkout doc
the repository
05-02
contains three local branches
master
,
doc
, and
info
. You
can check it using the
$ git branch
command. These three branches, that is,
mas-
ter
,
doc
, and
info
, are
local tracking branches
.
Hint
The command
$ git branch -a
prints local branches, local tracking
branches, and remote tracking branches. Although the output clearly shows which ones
are the remote tracking branches, the format used for ordinary local branches and local
tracking branches is the same. The more precise information is available if you also use
-vv
option.
You know from the Recipe 2-5 that cloning defines the relationship between a new
clone and the repository, which URL you passed to the
$ git clone
command. The
relationship is written in the
.git/config
file in the form:
[remote "origin"]
url = ...
You can also check it with the
$ git remote -v
command.
We will discuss remotes in greater detail in
chapter 10
, which deals with remote re-
positories and synchronization. Right now I only want to delete this relationship other-
wise the remote branches from the original repository will blur the output of various
commands, in particular
$ gitk --all
and
$ git log --all
. To remove the
relationship run:
$ git remote rm origin
This command removes:
• The
[remote "origin"]
entry from the repository's configuration
file
• All remote tracking branches
The command
$ git remote -v
now returns empty results and the command
$
git branch -a
prints only five local branches
doc
,
master
,
info
,
foo
, and