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