blob: 5dd6e5a0c7e7f215d4de783a2751e98e41c69948 [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 Hamano8b6e23b2009-02-01 06:36:0815The format of a <refspec> parameter is an optional plus
16`{plus}`, followed by the source ref <src>, followed
17by a colon `:`, followed by the destination ref <dst>.
Junio C Hamano1a4e8412005-12-27 08:17:2318+
Junio C Hamano40f2f8d2006-02-07 08:04:3919The remote ref that matches <src>
Junio C Hamano1a4e8412005-12-27 08:17:2320is fetched, and if <dst> is not empty string, the local
Junio C Hamano3f680f32009-11-16 02:10:5421ref that matches it is fast-forwarded using <src>.
Junio C Hamano8b6e23b2009-02-01 06:36:0822If the optional plus `+` is used, the local ref
Junio C Hamano3f680f32009-11-16 02:10:5423is updated even if it does not result in a fast-forward
Junio C Hamano1a4e8412005-12-27 08:17:2324update.
25+
26[NOTE]
27If the remote branch from which you want to pull is
28modified in non-linear ways such as being rewound and
29rebased frequently, then a pull will attempt a merge with
30an older version of itself, likely conflict, and fail.
31It is under these conditions that you would want to use
32the `+` sign to indicate non-fast-forward updates will
33be needed. There is currently no easy way to determine
34or declare that a branch will be made available in a
35repository with this behavior; the pulling user simply
36must know this is the expected usage pattern for a branch.
37+
38[NOTE]
39You never do your own development on branches that appear
40on the right hand side of a <refspec> colon on `Pull:` lines;
Junio C Hamano1aa40d22010-01-21 17:46:4341they are to be updated by 'git fetch'. If you intend to do
Junio C Hamano1a4e8412005-12-27 08:17:2342development derived from a remote branch `B`, have a `Pull:`
43line to track it (i.e. `Pull: B:remote-B`), and have a separate
44branch `my-B` to do your development on top of it. The latter
45is created by `git branch my-B remote-B` (or its equivalent `git
46checkout -b my-B remote-B`). Run `git fetch` to keep track of
47the progress of the remote side, and when you see something new
48on the remote branch, merge it into your development branch with
49`git pull . remote-B`, while you are on `my-B` branch.
Junio C Hamano1a4e8412005-12-27 08:17:2350+
51[NOTE]
52There is a difference between listing multiple <refspec>
Junio C Hamano1aa40d22010-01-21 17:46:4353directly on 'git pull' command line and having multiple
Junio C Hamano1a4e8412005-12-27 08:17:2354`Pull:` <refspec> lines for a <repository> and running
Junio C Hamano1aa40d22010-01-21 17:46:4355'git pull' command without any explicit <refspec> parameters.
Junio C Hamano1a4e8412005-12-27 08:17:2356<refspec> listed explicitly on the command line are always
57merged into the current branch after fetching. In other words,
58if you list more than one remote refs, you would be making
Junio C Hamano1aa40d22010-01-21 17:46:4359an Octopus. While 'git pull' run without any explicit <refspec>
Junio C Hamano1a4e8412005-12-27 08:17:2360parameter takes default <refspec>s from `Pull:` lines, it
61merges only the first <refspec> found into the current branch,
62after fetching all the remote refs. This is because making an
63Octopus from remote refs is rarely done, while keeping track
64of multiple remote heads in one-go by fetching more than one
65is often useful.
66+
67Some short-cut notations are also supported.
68+
Junio C Hamanoa77a5132007-06-08 16:13:4469* `tag <tag>` means the same as `refs/tags/<tag>:refs/tags/<tag>`;
Junio C Hamano40f2f8d2006-02-07 08:04:3970 it requests fetching everything up to the given tag.
Junio C Hamano1a4e8412005-12-27 08:17:2371* A parameter <ref> without a colon is equivalent to
Junio C Hamano40f2f8d2006-02-07 08:04:3972 <ref>: when pulling/fetching, so it merges <ref> into the current
73 branch without storing the remote branch anywhere locally