Documentation: format full commands in typewriter font
[git/git.git] / Documentation / pull-fetch-param.txt
CommitLineData
0c04094b 1<repository>::
bccf5956 2 The "remote" repository that is the source of a fetch
58124733
JF
3 or pull operation. This parameter can be either a URL
4 (see the section <<URLS,GIT URLS>> below) or the name
5 of a remote (see the section <<REMOTES,REMOTES>> below).
ab9b3138 6
9c4a036b
BG
7ifndef::git-pull[]
8<group>::
9 A name referring to a list of repositories as the value
10 of remotes.<group> in the configuration file.
11 (See linkgit:git-config[1]).
12endif::git-pull[]
13
ab9b3138 14<refspec>::
7a0d911f
JH
15 The format of a <refspec> parameter is an optional plus
16 `{plus}`, followed by the source ref <src>, followed
17 by a colon `:`, followed by the destination ref <dst>.
df8baa42 18+
3598a308 19The remote ref that matches <src>
df8baa42 20is fetched, and if <dst> is not empty string, the local
a75d7b54 21ref that matches it is fast-forwarded using <src>.
7a0d911f 22If the optional plus `+` is used, the local ref
a75d7b54 23is updated even if it does not result in a fast-forward
df8baa42
JF
24update.
25+
bccf5956
JL
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;
ba020ef5 41they are to be updated by 'git-fetch'. If you intend to do
4607166d
JH
42development 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.
bccf5956 50+
fdd08979
JH
51[NOTE]
52There is a difference between listing multiple <refspec>
ba020ef5 53directly on 'git-pull' command line and having multiple
fdd08979 54`Pull:` <refspec> lines for a <repository> and running
ba020ef5 55'git-pull' command without any explicit <refspec> parameters.
fdd08979
JH
56<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
ba020ef5 59an Octopus. While 'git-pull' run without any explicit <refspec>
fdd08979
JH
60parameter 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+
df8baa42
JF
67Some short-cut notations are also supported.
68+
a6080a0a 69* `tag <tag>` means the same as `refs/tags/<tag>:refs/tags/<tag>`;
3598a308 70 it requests fetching everything up to the given tag.
df8baa42 71* A parameter <ref> without a colon is equivalent to
3598a308
BF
72 <ref>: when pulling/fetching, so it merges <ref> into the current
73 branch without storing the remote branch anywhere locally