Documentation / git-fetch.txton commit Merge branch 'nd/struct-pathspec' (240fe05)
   1git-fetch(1)
   2============
   3
   4NAME
   5----
   6git-fetch - Download objects and refs from another repository
   7
   8
   9SYNOPSIS
  10--------
  11'git fetch' [<options>] [<repository> [<refspec>...]]
  12
  13'git fetch' [<options>] <group>
  14
  15'git fetch' --multiple [<options>] [(<repository> | <group>)...]
  16
  17'git fetch' --all [<options>]
  18
  19
  20DESCRIPTION
  21-----------
  22Fetches named heads or tags from one or more other repositories,
  23along with the objects necessary to complete them.
  24
  25The ref names and their object names of fetched refs are stored
  26in `.git/FETCH_HEAD`.  This information is left for a later merge
  27operation done by 'git merge'.
  28
  29When <refspec> stores the fetched result in remote-tracking branches,
  30the tags that point at these branches are automatically
  31followed.  This is done by first fetching from the remote using
  32the given <refspec>s, and if the repository has objects that are
  33pointed by remote tags that it does not yet have, then fetch
  34those missing tags.  If the other end has tags that point at
  35branches you are not interested in, you will not get them.
  36
  37'git fetch' can fetch from either a single named repository,
  38or from several repositories at once if <group> is given and
  39there is a remotes.<group> entry in the configuration file.
  40(See linkgit:git-config[1]).
  41
  42OPTIONS
  43-------
  44include::fetch-options.txt[]
  45
  46include::pull-fetch-param.txt[]
  47
  48include::urls-remotes.txt[]
  49
  50
  51EXAMPLES
  52--------
  53
  54* Update the remote-tracking branches:
  55+
  56------------------------------------------------
  57$ git fetch origin
  58------------------------------------------------
  59+
  60The above command copies all branches from the remote refs/heads/
  61namespace and stores them to the local refs/remotes/origin/ namespace,
  62unless the branch.<name>.fetch option is used to specify a non-default
  63refspec.
  64
  65* Using refspecs explicitly:
  66+
  67------------------------------------------------
  68$ git fetch origin +pu:pu maint:tmp
  69------------------------------------------------
  70+
  71This updates (or creates, as necessary) branches `pu` and `tmp` in
  72the local repository by fetching from the branches (respectively)
  73`pu` and `maint` from the remote repository.
  74+
  75The `pu` branch will be updated even if it is does not fast-forward,
  76because it is prefixed with a plus sign; `tmp` will not be.
  77
  78
  79BUGS
  80----
  81Using --recurse-submodules can only fetch new commits in already checked
  82out submodules right now. When e.g. upstream added a new submodule in the
  83just fetched commits of the superproject the submodule itself can not be
  84fetched, making it impossible to check out that submodule later without
  85having to do a fetch again. This is expected to be fixed in a future git
  86version.
  87
  88SEE ALSO
  89--------
  90linkgit:git-pull[1]
  91
  92GIT
  93---
  94Part of the linkgit:git[1] suite