Update git documentation
[TortoiseGit.git] / doc / source / en / TortoiseGit / git_doc / git-remote.xml
blobc8a4908dd4595ac12b977ae4a039eeb293b9bd33
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!DOCTYPE sect2 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">\r
3 \r
4 <sect2 lang="en" id="git-remote(1)">\r
5     <title>git-remote(1)</title>\r
6 <indexterm>\r
7 <primary>git-remote(1)</primary>\r
8 </indexterm>\r
9 <simplesect id="git-remote(1)__name">\r
10 <title>NAME</title>\r
11 <simpara>git-remote - Manage set of tracked repositories</simpara>\r
12 </simplesect>\r
13 <simplesect id="git-remote(1)__synopsis">\r
14 <title>SYNOPSIS</title>\r
15 <blockquote>\r
16 <literallayout><emphasis>git remote</emphasis> [-v | --verbose]\r
17 <emphasis>git remote add</emphasis> [-t &lt;branch&gt;] [-m &lt;master&gt;] [-f] [--[no-]tags] [--mirror=&lt;fetch|push&gt;] &lt;name&gt; &lt;url&gt;\r
18 <emphasis>git remote rename</emphasis> &lt;old&gt; &lt;new&gt;\r
19 <emphasis>git remote remove</emphasis> &lt;name&gt;\r
20 <emphasis>git remote set-head</emphasis> &lt;name&gt; (-a | --auto | -d | --delete | &lt;branch&gt;)\r
21 <emphasis>git remote set-branches</emphasis> [--add] &lt;name&gt; &lt;branch&gt;&#8230;\r
22 <emphasis>git remote get-url</emphasis> [--push] [--all] &lt;name&gt;\r
23 <emphasis>git remote set-url</emphasis> [--push] &lt;name&gt; &lt;newurl&gt; [&lt;oldurl&gt;]\r
24 <emphasis>git remote set-url --add</emphasis> [--push] &lt;name&gt; &lt;newurl&gt;\r
25 <emphasis>git remote set-url --delete</emphasis> [--push] &lt;name&gt; &lt;url&gt;\r
26 <emphasis>git remote</emphasis> [-v | --verbose] <emphasis>show</emphasis> [-n] &lt;name&gt;&#8230;\r
27 <emphasis>git remote prune</emphasis> [-n | --dry-run] &lt;name&gt;&#8230;\r
28 <emphasis>git remote</emphasis> [-v | --verbose] <emphasis>update</emphasis> [-p | --prune] [(&lt;group&gt; | &lt;remote&gt;)&#8230;]</literallayout>\r
29 </blockquote>\r
30 </simplesect>\r
31 <simplesect id="git-remote(1)__description">\r
32 <title>DESCRIPTION</title>\r
33 <simpara>Manage the set of repositories ("remotes") whose branches you track.</simpara>\r
34 </simplesect>\r
35 <simplesect id="git-remote(1)__options">\r
36 <title>OPTIONS</title>\r
37 <variablelist>\r
38 <varlistentry>\r
39 <term>\r
40 -v\r
41 </term>\r
42 <term>\r
43 --verbose\r
44 </term>\r
45 <listitem>\r
46 <simpara>\r
47         Be a little more verbose and show remote url after name.\r
48         NOTE: This must be placed between <emphasis>remote</emphasis> and <emphasis>subcommand</emphasis>.\r
49 </simpara>\r
50 </listitem>\r
51 </varlistentry>\r
52 </variablelist>\r
53 </simplesect>\r
54 <simplesect id="git-remote(1)__commands">\r
55 <title>COMMANDS</title>\r
56 <simpara>With no arguments, shows a list of existing remotes.  Several\r
57 subcommands are available to perform operations on the remotes.</simpara>\r
58 <variablelist>\r
59 <varlistentry>\r
60 <term>\r
61 <emphasis>add</emphasis>\r
62 </term>\r
63 <listitem>\r
64 <simpara>\r
65 Adds a remote named &lt;name&gt; for the repository at\r
66 &lt;url&gt;.  The command <emphasis>git fetch &lt;name&gt;</emphasis> can then be used to create and\r
67 update remote-tracking branches &lt;name&gt;/&lt;branch&gt;.\r
68 </simpara>\r
69 <simpara>With <emphasis>-f</emphasis> option, <emphasis>git fetch &lt;name&gt;</emphasis> is run immediately after\r
70 the remote information is set up.</simpara>\r
71 <simpara>With <emphasis>--tags</emphasis> option, <emphasis>git fetch &lt;name&gt;</emphasis> imports every tag from the\r
72 remote repository.</simpara>\r
73 <simpara>With <emphasis>--no-tags</emphasis> option, <emphasis>git fetch &lt;name&gt;</emphasis> does not import tags from\r
74 the remote repository.</simpara>\r
75 <simpara>By default, only tags on fetched branches are imported\r
76 (see <xref linkend="git-fetch(1)" />).</simpara>\r
77 <simpara>With <emphasis>-t &lt;branch&gt;</emphasis> option, instead of the default glob\r
78 refspec for the remote to track all branches under\r
79 the <emphasis>refs/remotes/&lt;name&gt;/</emphasis> namespace, a refspec to track only <emphasis>&lt;branch&gt;</emphasis>\r
80 is created.  You can give more than one <emphasis>-t &lt;branch&gt;</emphasis> to track\r
81 multiple branches without grabbing all branches.</simpara>\r
82 <simpara>With <emphasis>-m &lt;master&gt;</emphasis> option, a symbolic-ref <emphasis>refs/remotes/&lt;name&gt;/HEAD</emphasis> is set\r
83 up to point at remote's <emphasis>&lt;master&gt;</emphasis> branch. See also the set-head command.</simpara>\r
84 <simpara>When a fetch mirror is created with <emphasis>--mirror=fetch</emphasis>, the refs will not\r
85 be stored in the <emphasis>refs/remotes/</emphasis> namespace, but rather everything in\r
86 <emphasis>refs/</emphasis> on the remote will be directly mirrored into <emphasis>refs/</emphasis> in the\r
87 local repository. This option only makes sense in bare repositories,\r
88 because a fetch would overwrite any local commits.</simpara>\r
89 <simpara>When a push mirror is created with <emphasis>--mirror=push</emphasis>, then <emphasis>git push</emphasis>\r
90 will always behave as if <emphasis>--mirror</emphasis> was passed.</simpara>\r
91 </listitem>\r
92 </varlistentry>\r
93 <varlistentry>\r
94 <term>\r
95 <emphasis>rename</emphasis>\r
96 </term>\r
97 <listitem>\r
98 <simpara>\r
99 Rename the remote named &lt;old&gt; to &lt;new&gt;. All remote-tracking branches and\r
100 configuration settings for the remote are updated.\r
101 </simpara>\r
102 <simpara>In case &lt;old&gt; and &lt;new&gt; are the same, and &lt;old&gt; is a file under\r
103 <emphasis>$GIT_DIR/remotes</emphasis> or <emphasis>$GIT_DIR/branches</emphasis>, the remote is converted to\r
104 the configuration file format.</simpara>\r
105 </listitem>\r
106 </varlistentry>\r
107 <varlistentry>\r
108 <term>\r
109 <emphasis>remove</emphasis>\r
110 </term>\r
111 <term>\r
112 <emphasis>rm</emphasis>\r
113 </term>\r
114 <listitem>\r
115 <simpara>\r
116 Remove the remote named &lt;name&gt;. All remote-tracking branches and\r
117 configuration settings for the remote are removed.\r
118 </simpara>\r
119 </listitem>\r
120 </varlistentry>\r
121 <varlistentry>\r
122 <term>\r
123 <emphasis>set-head</emphasis>\r
124 </term>\r
125 <listitem>\r
126 <simpara>\r
127 Sets or deletes the default branch (i.e. the target of the\r
128 symbolic-ref <emphasis>refs/remotes/&lt;name&gt;/HEAD</emphasis>) for\r
129 the named remote. Having a default branch for a remote is not required,\r
130 but allows the name of the remote to be specified in lieu of a specific\r
131 branch. For example, if the default branch for <emphasis>origin</emphasis> is set to\r
132 <emphasis>master</emphasis>, then <emphasis>origin</emphasis> may be specified wherever you would normally\r
133 specify <emphasis>origin/master</emphasis>.\r
134 </simpara>\r
135 <simpara>With <emphasis>-d</emphasis> or <emphasis>--delete</emphasis>, the symbolic ref <emphasis>refs/remotes/&lt;name&gt;/HEAD</emphasis> is deleted.</simpara>\r
136 <simpara>With <emphasis>-a</emphasis> or <emphasis>--auto</emphasis>, the remote is queried to determine its <emphasis>HEAD</emphasis>, then the\r
137 symbolic-ref <emphasis>refs/remotes/&lt;name&gt;/HEAD</emphasis> is set to the same branch. e.g., if the remote\r
138 <emphasis>HEAD</emphasis> is pointed at <emphasis>next</emphasis>, "<emphasis>git remote set-head origin -a</emphasis>" will set\r
139 the symbolic-ref <emphasis>refs/remotes/origin/HEAD</emphasis> to <emphasis>refs/remotes/origin/next</emphasis>. This will\r
140 only work if <emphasis>refs/remotes/origin/next</emphasis> already exists; if not it must be\r
141 fetched first.</simpara>\r
142 <simpara>Use <emphasis>&lt;branch&gt;</emphasis> to set the symbolic-ref <emphasis>refs/remotes/&lt;name&gt;/HEAD</emphasis> explicitly. e.g., "git\r
143 remote set-head origin master" will set the symbolic-ref <emphasis>refs/remotes/origin/HEAD</emphasis> to\r
144 <emphasis>refs/remotes/origin/master</emphasis>. This will only work if\r
145 <emphasis>refs/remotes/origin/master</emphasis> already exists; if not it must be fetched first.</simpara>\r
146 </listitem>\r
147 </varlistentry>\r
148 <varlistentry>\r
149 <term>\r
150 <emphasis>set-branches</emphasis>\r
151 </term>\r
152 <listitem>\r
153 <simpara>\r
154 Changes the list of branches tracked by the named remote.\r
155 This can be used to track a subset of the available remote branches\r
156 after the initial setup for a remote.\r
157 </simpara>\r
158 <simpara>The named branches will be interpreted as if specified with the\r
159 <emphasis>-t</emphasis> option on the <emphasis>git remote add</emphasis> command line.</simpara>\r
160 <simpara>With <emphasis>--add</emphasis>, instead of replacing the list of currently tracked\r
161 branches, adds to that list.</simpara>\r
162 </listitem>\r
163 </varlistentry>\r
164 <varlistentry>\r
165 <term>\r
166 <emphasis>get-url</emphasis>\r
167 </term>\r
168 <listitem>\r
169 <simpara>\r
170 Retrieves the URLs for a remote. Configurations for <emphasis>insteadOf</emphasis> and\r
171 <emphasis>pushInsteadOf</emphasis> are expanded here. By default, only the first URL is listed.\r
172 </simpara>\r
173 <simpara>With <emphasis>--push</emphasis>, push URLs are queried rather than fetch URLs.</simpara>\r
174 <simpara>With <emphasis>--all</emphasis>, all URLs for the remote will be listed.</simpara>\r
175 </listitem>\r
176 </varlistentry>\r
177 <varlistentry>\r
178 <term>\r
179 <emphasis>set-url</emphasis>\r
180 </term>\r
181 <listitem>\r
182 <simpara>\r
183 Changes URLs for the remote. Sets first URL for remote &lt;name&gt; that matches\r
184 regex &lt;oldurl&gt; (first URL if no &lt;oldurl&gt; is given) to &lt;newurl&gt;. If\r
185 &lt;oldurl&gt; doesn't match any URL, an error occurs and nothing is changed.\r
186 </simpara>\r
187 <simpara>With <emphasis>--push</emphasis>, push URLs are manipulated instead of fetch URLs.</simpara>\r
188 <simpara>With <emphasis>--add</emphasis>, instead of changing existing URLs, new URL is added.</simpara>\r
189 <simpara>With <emphasis>--delete</emphasis>, instead of changing existing URLs, all URLs matching\r
190 regex &lt;url&gt; are deleted for remote &lt;name&gt;.  Trying to delete all\r
191 non-push URLs is an error.</simpara>\r
192 <simpara>Note that the push URL and the fetch URL, even though they can\r
193 be set differently, must still refer to the same place.  What you\r
194 pushed to the push URL should be what you would see if you\r
195 immediately fetched from the fetch URL.  If you are trying to\r
196 fetch from one place (e.g. your upstream) and push to another (e.g.\r
197 your publishing repository), use two separate remotes.</simpara>\r
198 </listitem>\r
199 </varlistentry>\r
200 <varlistentry>\r
201 <term>\r
202 <emphasis>show</emphasis>\r
203 </term>\r
204 <listitem>\r
205 <simpara>\r
206 Gives some information about the remote &lt;name&gt;.\r
207 </simpara>\r
208 <simpara>With <emphasis>-n</emphasis> option, the remote heads are not queried first with\r
209 <emphasis>git ls-remote &lt;name&gt;</emphasis>; cached information is used instead.</simpara>\r
210 </listitem>\r
211 </varlistentry>\r
212 <varlistentry>\r
213 <term>\r
214 <emphasis>prune</emphasis>\r
215 </term>\r
216 <listitem>\r
217 <simpara>\r
218 Deletes all stale remote-tracking branches under &lt;name&gt;.\r
219 These stale branches have already been removed from the remote repository\r
220 referenced by &lt;name&gt;, but are still locally available in\r
221 "remotes/&lt;name&gt;".\r
222 </simpara>\r
223 <simpara>With <emphasis>--dry-run</emphasis> option, report what branches will be pruned, but do not\r
224 actually prune them.</simpara>\r
225 </listitem>\r
226 </varlistentry>\r
227 <varlistentry>\r
228 <term>\r
229 <emphasis>update</emphasis>\r
230 </term>\r
231 <listitem>\r
232 <simpara>\r
233 Fetch updates for a named set of remotes in the repository as defined by\r
234 remotes.&lt;group&gt;.  If a named group is not specified on the command line,\r
235 the configuration parameter remotes.default will be used; if\r
236 remotes.default is not defined, all remotes which do not have the\r
237 configuration parameter remote.&lt;name&gt;.skipDefaultUpdate set to true will\r
238 be updated.  (See <xref linkend="git-config(1)" />).\r
239 </simpara>\r
240 <simpara>With <emphasis>--prune</emphasis> option, prune all the remotes that are updated.</simpara>\r
241 </listitem>\r
242 </varlistentry>\r
243 </variablelist>\r
244 </simplesect>\r
245 <simplesect id="git-remote(1)__discussion">\r
246 <title>DISCUSSION</title>\r
247 <simpara>The remote configuration is achieved using the <emphasis>remote.origin.url</emphasis> and\r
248 <emphasis>remote.origin.fetch</emphasis> configuration variables.  (See\r
249 <xref linkend="git-config(1)" />).</simpara>\r
250 </simplesect>\r
251 <simplesect id="git-remote(1)__examples">\r
252 <title>Examples</title>\r
253 <itemizedlist>\r
254 <listitem>\r
255 <simpara>\r
256 Add a new remote, fetch, and check out a branch from it\r
257 </simpara>\r
258 <screen>$ git remote\r
259 origin\r
260 $ git branch -r\r
261   origin/HEAD -&gt; origin/master\r
262   origin/master\r
263 $ git remote add staging git://git.kernel.org/.../gregkh/staging.git\r
264 $ git remote\r
265 origin\r
266 staging\r
267 $ git fetch staging\r
268 ...\r
269 From git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging\r
270  * [new branch]      master     -&gt; staging/master\r
271  * [new branch]      staging-linus -&gt; staging/staging-linus\r
272  * [new branch]      staging-next -&gt; staging/staging-next\r
273 $ git branch -r\r
274   origin/HEAD -&gt; origin/master\r
275   origin/master\r
276   staging/master\r
277   staging/staging-linus\r
278   staging/staging-next\r
279 $ git checkout -b staging staging/master\r
280 ...</screen>\r
281 </listitem>\r
282 <listitem>\r
283 <simpara>\r
284 Imitate <emphasis>git clone</emphasis> but track only selected branches\r
285 </simpara>\r
286 <screen>$ mkdir project.git\r
287 $ cd project.git\r
288 $ git init\r
289 $ git remote add -f -t master -m master origin git://example.com/git.git/\r
290 $ git merge origin</screen>\r
291 </listitem>\r
292 </itemizedlist>\r
293 </simplesect>\r
294 <simplesect id="git-remote(1)__see_also">\r
295 <title>SEE ALSO</title>\r
296 <simpara><xref linkend="git-fetch(1)" />\r
297 <xref linkend="git-branch(1)" />\r
298 <xref linkend="git-config(1)" /></simpara>\r
299 </simplesect>\r
300 <simplesect id="git-remote(1)__git">\r
301 <title>GIT</title>\r
302 <simpara>Part of the <xref linkend="git(1)" /> suite</simpara>\r
303 </simplesect>\r
304 </sect2>\r