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 22their histories. 23 24The names of refs that are fetched, together with the object names 25they point at, are written to `.git/FETCH_HEAD`. This information 26can be used to learn what was fetched. In addition, the remote-tracking 27branches are updated (see description on <refspec> below for details). 28 29By default, any tag that points into the histories being fetched is 30also fetched; the effect is to fetch tags that 31point at branches that you are interested in. This default behavior 32can be changed by using the --tags or --no-tags options or by 33configuring remote.<name>.tagopt. By using a refspec that fetches tags 34explicitly, you can fetch tags that do not point into branches you 35are interested in as well. 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 42When no remote is specified, by default the `origin` remote will be used, 43unless there's an upstream branch configured for the current branch. 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 82BUGS 83---- 84Using --recurse-submodules can only fetch new commits in already checked 85out submodules right now. When e.g. upstream added a new submodule in the 86just fetched commits of the superproject the submodule itself can not be 87fetched, making it impossible to check out that submodule later without 88having to do a fetch again. This is expected to be fixed in a future Git 89version. 90 91SEE ALSO 92-------- 93linkgit:git-pull[1] 94 95GIT 96--- 97Part of the linkgit:git[1] suite