git-format-patch: silly typo fix.
[git/git.git] / Documentation / pull-fetch-param.txt
CommitLineData
0c04094b 1<repository>::
bccf5956
JL
2 The "remote" repository that is the source of a fetch
3 or pull operation, or the destination of a push operation.
4 One of the following notations can be used
5 to name the remote repository:
df8baa42
JF
6+
7===============================================================
8- Rsync URL: rsync://remote.machine/path/to/repo.git/
9- HTTP(s) URL: http://remote.machine/path/to/repo.git/
72e9340c 10- git URL: git://remote.machine/path/to/repo.git/
df8baa42
JF
11 or remote.machine:/path/to/repo.git/
12- Local directory: /path/to/repo.git/
13===============================================================
14+
15In addition to the above, as a short-hand, the name of a
bccf5956 16file in `$GIT_DIR/remotes` directory can be given; the
df8baa42
JF
17named file should be in the following format:
18+
19 URL: one of the above URL format
fdd08979
JH
20 Push: <refspec>
21 Pull: <refspec>
df8baa42
JF
22+
23When such a short-hand is specified in place of
24<repository> without <refspec> parameters on the command
fdd08979 25line, <refspec> specified on `Push:` lines or `Pull:`
bccf5956
JL
26lines are used for `git-push` and `git-fetch`/`git-pull`,
27respectively. Multiple `Push:` and and `Pull:` lines may
28be specified for additional branch mappings.
df8baa42 29+
bccf5956 30The name of a file in `$GIT_DIR/branches` directory can be
df8baa42
JF
31specified as an older notation short-hand; the named
32file should contain a single line, a URL in one of the
bccf5956 33above formats, optionally followed by a hash `#` and the
df8baa42 34name of remote head (URL fragment notation).
bccf5956 35`$GIT_DIR/branches/<remote>` file that stores a <url>
df8baa42 36without the fragment is equivalent to have this in the
bccf5956 37corresponding file in the `$GIT_DIR/remotes/` directory.
df8baa42
JF
38+
39 URL: <url>
40 Pull: refs/heads/master:<remote>
41+
bccf5956 42while having `<url>#<head>` is equivalent to
df8baa42
JF
43+
44 URL: <url>
45 Pull: refs/heads/<head>:<remote>
ab9b3138
JH
46
47<refspec>::
48 The canonical format of a <refspec> parameter is
bccf5956
JL
49 `+?<src>:<dst>`; that is, an optional plus `+`, followed
50 by the source ref, followed by a colon `:`, followed by
ab9b3138 51 the destination ref.
df8baa42 52+
bccf5956 53When used in `git-push`, the <src> side can be an
df8baa42 54arbitrary "SHA1 expression" that can be used as an
bccf5956 55argument to `git-cat-file -t`. E.g. `master~4` (push
df8baa42
JF
56four parents before the current master head).
57+
bccf5956 58For `git-push`, the local ref that matches <src> is used
df8baa42 59to fast forward the remote ref that matches <dst>. If
bccf5956 60the optional plus `+` is used, the remote ref is updated
df8baa42
JF
61even if it does not result in a fast forward update.
62+
bccf5956 63For `git-fetch` and `git-pull`, the remote ref that matches <src>
df8baa42
JF
64is fetched, and if <dst> is not empty string, the local
65ref that matches it is fast forwarded using <src>.
bccf5956 66Again, if the optional plus `+` is used, the local ref
df8baa42
JF
67is updated even if it does not result in a fast forward
68update.
69+
bccf5956
JL
70[NOTE]
71If the remote branch from which you want to pull is
72modified in non-linear ways such as being rewound and
73rebased frequently, then a pull will attempt a merge with
74an older version of itself, likely conflict, and fail.
75It is under these conditions that you would want to use
76the `+` sign to indicate non-fast-forward updates will
77be needed. There is currently no easy way to determine
78or declare that a branch will be made available in a
79repository with this behavior; the pulling user simply
80must know this is the expected usage pattern for a branch.
81+
82[NOTE]
83You never do your own development on branches that appear
84on the right hand side of a <refspec> colon on `Pull:` lines;
85they are to be updated by `git-fetch`. The corollary is that
86a local branch should be introduced and named on a <refspec>
87right-hand-side if you intend to do development derived from
88that branch.
89This leads to the common `Pull: master:origin` mapping of a
90remote `master` branch to a local `origin` branch, which
91is then merged to a local development branch, again typically
92named `master`.
93+
fdd08979
JH
94[NOTE]
95There is a difference between listing multiple <refspec>
96directly on `git-pull` command line and having multiple
97`Pull:` <refspec> lines for a <repository> and running
98`git-pull` command without any explicit <refspec> parameters.
99<refspec> listed explicitly on the command line are always
100merged into the current branch after fetching. In other words,
101if you list more than one remote refs, you would be making
102an Octopus. While `git-pull` run without any explicit <refspec>
103parameter takes default <refspec>s from `Pull:` lines, it
104merges only the first <refspec> found into the current branch,
105after fetching all the remote refs. This is because making an
106Octopus from remote refs is rarely done, while keeping track
107of multiple remote heads in one-go by fetching more than one
108is often useful.
109+
df8baa42
JF
110Some short-cut notations are also supported.
111+
bccf5956 112* For backward compatibility, `tag` is almost ignored;
df8baa42 113 it just makes the following parameter <tag> to mean a
bccf5956 114 refspec `refs/tags/<tag>:refs/tags/<tag>`.
df8baa42 115* A parameter <ref> without a colon is equivalent to
bccf5956 116 <ref>: when pulling/fetching, and <ref>`:`<ref> when
df8baa42
JF
117 pushing. That is, do not store it locally if
118 fetching, and update the same name if pushing.
61420a2c 119