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