Documentation / git-fetch.txton commit fetch doc: update note on '+' in front of the refspec (f471dbc)
   1git-fetch(1)
   2============
   3
   4NAME
   5----
   6git-fetch - Download objects and refs from another repository
   7
   8
   9SYNOPSIS
  10--------
  11[verse]
  12'git fetch' [<options>] [<repository> [<refspec>...]]
  13'git fetch' [<options>] <group>
  14'git fetch' --multiple [<options>] [(<repository> | <group>)...]
  15'git fetch' --all [<options>]
  16
  17
  18DESCRIPTION
  19-----------
  20Fetch branches and/or tags (collectively, "refs") from one or more
  21other repositories, along with the objects necessary to complete their
  22histories.  Remote-tracking branches are updated (see the description
  23of <refspec> below for ways to control this behavior).
  24
  25By default, any tag that points into the histories being fetched is
  26also fetched; the effect is to fetch tags that
  27point at branches that you are interested in.  This default behavior
  28can be changed by using the --tags or --no-tags options or by
  29configuring remote.<name>.tagopt.  By using a refspec that fetches tags
  30explicitly, you can fetch tags that do not point into branches you
  31are interested in as well.
  32
  33'git fetch' can fetch from either a single named repository or URL,
  34or from several repositories at once if <group> is given and
  35there is a remotes.<group> entry in the configuration file.
  36(See linkgit:git-config[1]).
  37
  38When no remote is specified, by default the `origin` remote will be used,
  39unless there's an upstream branch configured for the current branch.
  40
  41The names of refs that are fetched, together with the object names
  42they point at, are written to `.git/FETCH_HEAD`.  This information
  43may be used by scripts or other git commands, such as linkgit:git-pull[1].
  44
  45OPTIONS
  46-------
  47include::fetch-options.txt[]
  48
  49include::pull-fetch-param.txt[]
  50
  51include::urls-remotes.txt[]
  52
  53
  54EXAMPLES
  55--------
  56
  57* Update the remote-tracking branches:
  58+
  59------------------------------------------------
  60$ git fetch origin
  61------------------------------------------------
  62+
  63The above command copies all branches from the remote refs/heads/
  64namespace and stores them to the local refs/remotes/origin/ namespace,
  65unless the branch.<name>.fetch option is used to specify a non-default
  66refspec.
  67
  68* Using refspecs explicitly:
  69+
  70------------------------------------------------
  71$ git fetch origin +pu:pu maint:tmp
  72------------------------------------------------
  73+
  74This updates (or creates, as necessary) branches `pu` and `tmp` in
  75the local repository by fetching from the branches (respectively)
  76`pu` and `maint` from the remote repository.
  77+
  78The `pu` branch will be updated even if it is does not fast-forward,
  79because it is prefixed with a plus sign; `tmp` will not be.
  80
  81* Peek at a remote's branch, without configuring the remote in your local
  82repository:
  83+
  84------------------------------------------------
  85$ git fetch git://git.kernel.org/pub/scm/git/git.git maint
  86$ git log FETCH_HEAD
  87------------------------------------------------
  88+
  89The first command fetches the `maint` branch from the repository at
  90`git://git.kernel.org/pub/scm/git/git.git` and the second command uses
  91`FETCH_HEAD` to examine the branch with linkgit:git-log[1].  The fetched
  92objects will eventually be removed by git's built-in housekeeping (see
  93linkgit:git-gc[1]).
  94
  95BUGS
  96----
  97Using --recurse-submodules can only fetch new commits in already checked
  98out submodules right now. When e.g. upstream added a new submodule in the
  99just fetched commits of the superproject the submodule itself can not be
 100fetched, making it impossible to check out that submodule later without
 101having to do a fetch again. This is expected to be fixed in a future Git
 102version.
 103
 104SEE ALSO
 105--------
 106linkgit:git-pull[1]
 107
 108GIT
 109---
 110Part of the linkgit:git[1] suite