blob: b41d7c1de1e501e267bc9dfb0c13819b04e3b8aa [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231git-fetch(1)
2============
3
4NAME
5----
Junio C Hamano7c73c662007-01-19 00:37:506git-fetch - Download objects and refs from another repository
Junio C Hamano1a4e8412005-12-27 08:17:237
8
9SYNOPSIS
10--------
Junio C Hamano15567bc2011-07-23 00:51:5911[verse]
Junio C Hamano3a869c12010-04-10 07:53:4212'git fetch' [<options>] [<repository> [<refspec>...]]
Junio C Hamano3a869c12010-04-10 07:53:4213'git fetch' [<options>] <group>
Junio C Hamanod2179ef2010-10-22 04:12:1714'git fetch' --multiple [<options>] [(<repository> | <group>)...]
Junio C Hamano3a869c12010-04-10 07:53:4215'git fetch' --all [<options>]
Junio C Hamano9df0c662009-11-23 11:09:2716
Junio C Hamano1a4e8412005-12-27 08:17:2317
18DESCRIPTION
19-----------
Junio C Hamano9df0c662009-11-23 11:09:2720Fetches named heads or tags from one or more other repositories,
21along with the objects necessary to complete them.
Junio C Hamano1a4e8412005-12-27 08:17:2322
23The ref names and their object names of fetched refs are stored
24in `.git/FETCH_HEAD`. This information is left for a later merge
Junio C Hamano1aa40d22010-01-21 17:46:4325operation done by 'git merge'.
Junio C Hamano1a4e8412005-12-27 08:17:2326
Junio C Hamano97bcb482010-11-25 03:16:0727When <refspec> stores the fetched result in remote-tracking branches,
Junio C Hamano8be70732007-02-10 01:28:4028the 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
Junio C Hamano3eee5872011-04-13 22:40:2335'git fetch' can fetch from either a single named repository,
Junio C Hamano9df0c662009-11-23 11:09:2736or 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]).
Junio C Hamano1a4e8412005-12-27 08:17:2339
40OPTIONS
41-------
42include::fetch-options.txt[]
43
44include::pull-fetch-param.txt[]
45
Junio C Hamano330aae62007-07-06 17:01:5846include::urls-remotes.txt[]
Junio C Hamano1a4e8412005-12-27 08:17:2347
Junio C Hamanoc21ab052009-10-31 04:03:5548
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
Junio C Hamano5cd15182011-04-05 00:21:1077BUGS
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
Junio C Hamano1a4e8412005-12-27 08:17:2386SEE ALSO
87--------
Junio C Hamano35738e82008-01-07 07:55:4688linkgit:git-pull[1]
Junio C Hamano1a4e8412005-12-27 08:17:2389
Junio C Hamano1a4e8412005-12-27 08:17:2390GIT
91---
Junio C Hamanof7c042d2008-06-06 22:50:5392Part of the linkgit:git[1] suite