Documentation / git-fetch.txton commit Git 1.9.1 (cee0c27)
   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-----------
  20Fetches named heads or tags from one or more other repositories,
  21along with the objects necessary to complete them.
  22
  23The ref names and their object names of fetched refs are stored
  24in `.git/FETCH_HEAD`.  This information is left for a later merge
  25operation done by 'git merge'.
  26
  27By default, tags are auto-followed.  This means that when fetching
  28from a remote, any tags on the remote that point to objects that exist
  29in the local repository are fetched.  The effect is to fetch tags that
  30point at branches that you are interested in.  This default behavior
  31can be changed by using the --tags or --no-tags options, by
  32configuring remote.<name>.tagopt, or by using a refspec that fetches
  33tags explicitly.
  34
  35'git fetch' can fetch from either a single named repository,
  36or from several repositories at once if <group> is given and
  37there is a remotes.<group> entry in the configuration file.
  38(See linkgit:git-config[1]).
  39
  40When no remote is specified, by default the `origin` remote will be used,
  41unless there's an upstream branch configured for the current branch.
  42
  43OPTIONS
  44-------
  45include::fetch-options.txt[]
  46
  47include::pull-fetch-param.txt[]
  48
  49include::urls-remotes.txt[]
  50
  51
  52EXAMPLES
  53--------
  54
  55* Update the remote-tracking branches:
  56+
  57------------------------------------------------
  58$ git fetch origin
  59------------------------------------------------
  60+
  61The above command copies all branches from the remote refs/heads/
  62namespace and stores them to the local refs/remotes/origin/ namespace,
  63unless the branch.<name>.fetch option is used to specify a non-default
  64refspec.
  65
  66* Using refspecs explicitly:
  67+
  68------------------------------------------------
  69$ git fetch origin +pu:pu maint:tmp
  70------------------------------------------------
  71+
  72This updates (or creates, as necessary) branches `pu` and `tmp` in
  73the local repository by fetching from the branches (respectively)
  74`pu` and `maint` from the remote repository.
  75+
  76The `pu` branch will be updated even if it is does not fast-forward,
  77because it is prefixed with a plus sign; `tmp` will not be.
  78
  79
  80BUGS
  81----
  82Using --recurse-submodules can only fetch new commits in already checked
  83out submodules right now. When e.g. upstream added a new submodule in the
  84just fetched commits of the superproject the submodule itself can not be
  85fetched, making it impossible to check out that submodule later without
  86having to do a fetch again. This is expected to be fixed in a future Git
  87version.
  88
  89SEE ALSO
  90--------
  91linkgit:git-pull[1]
  92
  93GIT
  94---
  95Part of the linkgit:git[1] suite