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 14DESCRIPTION 15----------- 16Fetches named heads or tags from another repository, along with 17the objects necessary to complete them. 18 19The ref names and their object names of fetched refs are stored 20in `.git/FETCH_HEAD`. This information is left for a later merge 21operation done by 'git-merge'. 22 23When <refspec> stores the fetched result in tracking branches, 24the tags that point at these branches are automatically 25followed. This is done by first fetching from the remote using 26the given <refspec>s, and if the repository has objects that are 27pointed by remote tags that it does not yet have, then fetch 28those missing tags. If the other end has tags that point at 29branches you are not interested in, you will not get them. 30 31 32OPTIONS 33------- 34include::fetch-options.txt[] 35 36include::pull-fetch-param.txt[] 37 38include::urls-remotes.txt[] 39 40 41EXAMPLES 42-------- 43 44* Update the remote-tracking branches: 45+ 46------------------------------------------------ 47$ git fetch origin 48------------------------------------------------ 49+ 50The above command copies all branches from the remote refs/heads/ 51namespace and stores them to the local refs/remotes/origin/ namespace, 52unless the branch.<name>.fetch option is used to specify a non-default 53refspec. 54 55* Using refspecs explicitly: 56+ 57------------------------------------------------ 58$ git fetch origin +pu:pu maint:tmp 59------------------------------------------------ 60+ 61This updates (or creates, as necessary) branches `pu` and `tmp` in 62the local repository by fetching from the branches (respectively) 63`pu` and `maint` from the remote repository. 64+ 65The `pu` branch will be updated even if it is does not fast-forward, 66because it is prefixed with a plus sign; `tmp` will not be. 67 68 69SEE ALSO 70-------- 71linkgit:git-pull[1] 72 73 74Author 75------ 76Written by Linus Torvalds <torvalds@osdl.org> and 77Junio C Hamano <gitster@pobox.com> 78 79Documentation 80------------- 81Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>. 82 83GIT 84--- 85Part of the linkgit:git[1] suite