Information Technology Reference
In-Depth Information
The above command performed the following operations:
• It deleted
doc
branch in
shared-repo.
• It deleted remote the tracking branch
origin/doc
in
johns-repo.
• It didn't convert the local tracking branch
doc
in
johns-repo
into or-
dinary local branch, however. The
doc
branch in
johns-repo
is still
tracking a nonexistent
origin/doc
remote tracking branch. You can
verify this with the
$ git branch -avv
command.
Hint
What is the difference between a local tracking branch and an ordinary local
branch? You can commit in both of them, of course. But a local tracking branch is con-
nected to a remote tracking branch; therefore, you can use
$ git status -sb
to
check if a local tracking branch is ahead or behind of a corresponding remote tracking
branch.
Therefore,
shared-repo
doesn't contain the
doc
branch anymore. The com-
mand
$ git branch
executed in
shared-repo
prints two branches:
master
and
special-unit-tests
. In John's repository, however, the branch
doc
still ex-
ists—it is an ordinary local branch.
Sarah updates her remote branches with:
# sarah's command
$ git fetch
However, the above command doesn't remove the remote tracking branch
ori-
gin/doc
for a nonexistent remote branch
doc
in
shared-repo
. If Sarah wants to
update her repository in such a way that it reflects deleted remote branches she needs
the following command:
# sarah's command
$ git remote prune origin
The above command deletes the remote tracking branch
origin/doc
in Sarah's
repository. This operation can be performed automatically during fetch with an addi-
tional
-p
flag: