blob: c579793af5b41a01fecda884c514ff78bf25672a [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231<repository>::
2The "remote" repository that is the source of a fetch
Junio C Hamano054ea082008-06-01 08:26:343or pull operation. This parameter can be either a URL
4(see the section <<URLS,GIT URLS>> below) or the name
5of a remote (see the section <<REMOTES,REMOTES>> below).
Junio C Hamano1a4e8412005-12-27 08:17:236
Junio C Hamano9df0c662009-11-23 11:09:277ifndef::git-pull[]
8<group>::
9A name referring to a list of repositories as the value
10of remotes.<group> in the configuration file.
11(See linkgit:git-config[1]).
12endif::git-pull[]
13
Junio C Hamano1a4e8412005-12-27 08:17:2314<refspec>::
Junio C Hamano45f804f2014-06-20 22:24:4915Specifies which refs to fetch and which local refs to update.
16When no <refspec>s appear on the command line, the refs to fetch
17are read from `remote.<repository>.fetch` variables instead
18ifndef::git-pull[]
19(see <<CRTB,CONFIGURED REMOTE-TRACKING BRANCHES>> below).
20endif::git-pull[]
21ifdef::git-pull[]
22(see linkgit:git-fetch[1]).
23endif::git-pull[]
24+
25The format of a <refspec> parameter is an optional plus
Junio C Hamanof7e3f472017-10-20 06:45:2426`+`, followed by the source <src>, followed
Junio C Hamano45f804f2014-06-20 22:24:4927by a colon `:`, followed by the destination ref <dst>.
Junio C Hamanof7e3f472017-10-20 06:45:2428The colon can be omitted when <dst> is empty. <src> is
29typically a ref, but it can also be a fully spelled hex object
30name.
Junio C Hamano45f804f2014-06-20 22:24:4931+
32`tag <tag>` means the same as `refs/tags/<tag>:refs/tags/<tag>`;
33it requests fetching everything up to the given tag.
Junio C Hamano1a4e8412005-12-27 08:17:2334+
Junio C Hamano40f2f8d2006-02-07 08:04:3935The remote ref that matches <src>
Junio C Hamano1a4e8412005-12-27 08:17:2336is fetched, and if <dst> is not empty string, the local
Junio C Hamano3f680f32009-11-16 02:10:5437ref that matches it is fast-forwarded using <src>.
Junio C Hamano8b6e23b2009-02-01 06:36:0838If the optional plus `+` is used, the local ref
Junio C Hamano3f680f32009-11-16 02:10:5439is updated even if it does not result in a fast-forward
Junio C Hamano1a4e8412005-12-27 08:17:2340update.
41+
42[NOTE]
Junio C Hamano45f804f2014-06-20 22:24:4943When the remote branch you want to fetch is known to
44be rewound and rebased regularly, it is expected that
45its new tip will not be descendant of its previous tip
46(as stored in your remote-tracking branch the last time
47you fetched). You would want
48to use the `+` sign to indicate non-fast-forward updates
49will be needed for such branches. There is no way to
50determine or declare that a branch will be made available
51in a repository with this behavior; the pulling user simply
Junio C Hamano1a4e8412005-12-27 08:17:2352must know this is the expected usage pattern for a branch.
Junio C Hamano45f804f2014-06-20 22:24:4953ifdef::git-pull[]
Junio C Hamano1a4e8412005-12-27 08:17:2354+
55[NOTE]
56There is a difference between listing multiple <refspec>
Junio C Hamano1aa40d22010-01-21 17:46:4357directly on 'git pull' command line and having multiple
Junio C Hamano45f804f2014-06-20 22:24:4958`remote.<repository>.fetch` entries in your configuration
59for a <repository> and running a
Junio C Hamano1aa40d22010-01-21 17:46:4360'git pull' command without any explicit <refspec> parameters.
Junio C Hamano45f804f2014-06-20 22:24:4961<refspec>s listed explicitly on the command line are always
Junio C Hamano1a4e8412005-12-27 08:17:2362merged into the current branch after fetching. In other words,
Junio C Hamano45f804f2014-06-20 22:24:4963if you list more than one remote ref, 'git pull' will create
64an Octopus merge. On the other hand, if you do not list any
65explicit <refspec> parameter on the command line, 'git pull'
66will fetch all the <refspec>s it finds in the
67`remote.<repository>.fetch` configuration and merge
68only the first <refspec> found into the current branch.
69This is because making an
Junio C Hamano1a4e8412005-12-27 08:17:2370Octopus from remote refs is rarely done, while keeping track
71of multiple remote heads in one-go by fetching more than one
72is often useful.
Junio C Hamano7e590a12013-06-02 23:46:5273endif::git-pull[]