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