• Update the remote-tracking branches:
$ git fetch origin
The above command copies all branches from the remote
refs/heads/ namespace and stores them to the local
refs/remotes/origin/ namespace, unless the
branch.<name>.fetch option is used to specify a non-default
refspec.
• Using refspecs explicitly:
$ git fetch origin +seen:seen maint:tmp
This updates (or creates, as necessary) branches seen
and tmp
in the local repository by fetching from the branches
(respectively) seen
and maint
from the remote repository.
The seen
branch will be updated even if it does not
fast-forward, because it is prefixed with a plus sign; tmp
will not be.
• Peek at a remote's branch, without configuring the remote in
your local repository:
$ git fetch git://git.kernel.org/pub/scm/git/git.git maint
$ git log FETCH_HEAD
The first command fetches the maint
branch from the
repository at git://git.kernel.org/pub/scm/git/git.git
and
the second command uses FETCH_HEAD
to examine the branch with
git-log(1). The fetched objects will eventually be removed by
git's built-in housekeeping (see git-gc(1)).