Autogenerated HTML docs for v1.7.5-52-ge839f
[git/jnareb-git.git] / git-fetch.html
blobf88b40ed6a28823728c844a61ef2927ece7d1208
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <meta name="generator" content="AsciiDoc 8.4.5" />
7 <title>git-fetch(1)</title>
8 <style type="text/css">
9 /* Debug borders */
10 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
12 border: 1px solid red;
16 body {
17 margin: 1em 5% 1em 5%;
20 a {
21 color: blue;
22 text-decoration: underline;
24 a:visited {
25 color: fuchsia;
28 em {
29 font-style: italic;
30 color: navy;
33 strong {
34 font-weight: bold;
35 color: #083194;
38 tt {
39 color: navy;
42 h1, h2, h3, h4, h5, h6 {
43 color: #527bbd;
44 font-family: sans-serif;
45 margin-top: 1.2em;
46 margin-bottom: 0.5em;
47 line-height: 1.3;
50 h1, h2, h3 {
51 border-bottom: 2px solid silver;
53 h2 {
54 padding-top: 0.5em;
56 h3 {
57 float: left;
59 h3 + * {
60 clear: left;
63 div.sectionbody {
64 font-family: serif;
65 margin-left: 0;
68 hr {
69 border: 1px solid silver;
72 p {
73 margin-top: 0.5em;
74 margin-bottom: 0.5em;
77 ul, ol, li > p {
78 margin-top: 0;
81 pre {
82 padding: 0;
83 margin: 0;
86 span#author {
87 color: #527bbd;
88 font-family: sans-serif;
89 font-weight: bold;
90 font-size: 1.1em;
92 span#email {
94 span#revnumber, span#revdate, span#revremark {
95 font-family: sans-serif;
98 div#footer {
99 font-family: sans-serif;
100 font-size: small;
101 border-top: 2px solid silver;
102 padding-top: 0.5em;
103 margin-top: 4.0em;
105 div#footer-text {
106 float: left;
107 padding-bottom: 0.5em;
109 div#footer-badges {
110 float: right;
111 padding-bottom: 0.5em;
114 div#preamble {
115 margin-top: 1.5em;
116 margin-bottom: 1.5em;
118 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
119 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
120 div.admonitionblock {
121 margin-top: 1.5em;
122 margin-bottom: 1.5em;
124 div.admonitionblock {
125 margin-top: 2.5em;
126 margin-bottom: 2.5em;
129 div.content { /* Block element content. */
130 padding: 0;
133 /* Block element titles. */
134 div.title, caption.title {
135 color: #527bbd;
136 font-family: sans-serif;
137 font-weight: bold;
138 text-align: left;
139 margin-top: 1.0em;
140 margin-bottom: 0.5em;
142 div.title + * {
143 margin-top: 0;
146 td div.title:first-child {
147 margin-top: 0.0em;
149 div.content div.title:first-child {
150 margin-top: 0.0em;
152 div.content + div.title {
153 margin-top: 0.0em;
156 div.sidebarblock > div.content {
157 background: #ffffee;
158 border: 1px solid silver;
159 padding: 0.5em;
162 div.listingblock > div.content {
163 border: 1px solid silver;
164 background: #f4f4f4;
165 padding: 0.5em;
168 div.quoteblock {
169 padding-left: 2.0em;
170 margin-right: 10%;
172 div.quoteblock > div.attribution {
173 padding-top: 0.5em;
174 text-align: right;
177 div.verseblock {
178 padding-left: 2.0em;
179 margin-right: 10%;
181 div.verseblock > div.content {
182 white-space: pre;
184 div.verseblock > div.attribution {
185 padding-top: 0.75em;
186 text-align: left;
188 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
189 div.verseblock + div.attribution {
190 text-align: left;
193 div.admonitionblock .icon {
194 vertical-align: top;
195 font-size: 1.1em;
196 font-weight: bold;
197 text-decoration: underline;
198 color: #527bbd;
199 padding-right: 0.5em;
201 div.admonitionblock td.content {
202 padding-left: 0.5em;
203 border-left: 2px solid silver;
206 div.exampleblock > div.content {
207 border-left: 2px solid silver;
208 padding: 0.5em;
211 div.imageblock div.content { padding-left: 0; }
212 span.image img { border-style: none; }
213 a.image:visited { color: white; }
215 dl {
216 margin-top: 0.8em;
217 margin-bottom: 0.8em;
219 dt {
220 margin-top: 0.5em;
221 margin-bottom: 0;
222 font-style: normal;
223 color: navy;
225 dd > *:first-child {
226 margin-top: 0.1em;
229 ul, ol {
230 list-style-position: outside;
232 ol.arabic {
233 list-style-type: decimal;
235 ol.loweralpha {
236 list-style-type: lower-alpha;
238 ol.upperalpha {
239 list-style-type: upper-alpha;
241 ol.lowerroman {
242 list-style-type: lower-roman;
244 ol.upperroman {
245 list-style-type: upper-roman;
248 div.compact ul, div.compact ol,
249 div.compact p, div.compact p,
250 div.compact div, div.compact div {
251 margin-top: 0.1em;
252 margin-bottom: 0.1em;
255 div.tableblock > table {
256 border: 3px solid #527bbd;
258 thead {
259 font-family: sans-serif;
260 font-weight: bold;
262 tfoot {
263 font-weight: bold;
265 td > div.verse {
266 white-space: pre;
268 p.table {
269 margin-top: 0;
271 /* Because the table frame attribute is overriden by CSS in most browsers. */
272 div.tableblock > table[frame="void"] {
273 border-style: none;
275 div.tableblock > table[frame="hsides"] {
276 border-left-style: none;
277 border-right-style: none;
279 div.tableblock > table[frame="vsides"] {
280 border-top-style: none;
281 border-bottom-style: none;
285 div.hdlist {
286 margin-top: 0.8em;
287 margin-bottom: 0.8em;
289 div.hdlist tr {
290 padding-bottom: 15px;
292 dt.hdlist1.strong, td.hdlist1.strong {
293 font-weight: bold;
295 td.hdlist1 {
296 vertical-align: top;
297 font-style: normal;
298 padding-right: 0.8em;
299 color: navy;
301 td.hdlist2 {
302 vertical-align: top;
304 div.hdlist.compact tr {
305 margin: 0;
306 padding-bottom: 0;
309 .comment {
310 background: yellow;
313 @media print {
314 div#footer-badges { display: none; }
317 div#toctitle {
318 color: #527bbd;
319 font-family: sans-serif;
320 font-size: 1.1em;
321 font-weight: bold;
322 margin-top: 1.0em;
323 margin-bottom: 0.1em;
326 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
327 margin-top: 0;
328 margin-bottom: 0;
330 div.toclevel2 {
331 margin-left: 2em;
332 font-size: 0.9em;
334 div.toclevel3 {
335 margin-left: 4em;
336 font-size: 0.9em;
338 div.toclevel4 {
339 margin-left: 6em;
340 font-size: 0.9em;
342 /* Overrides for manpage documents */
343 h1 {
344 padding-top: 0.5em;
345 padding-bottom: 0.5em;
346 border-top: 2px solid silver;
347 border-bottom: 2px solid silver;
349 h2 {
350 border-style: none;
352 div.sectionbody {
353 margin-left: 5%;
356 @media print {
357 div#toc { display: none; }
360 /* Workarounds for IE6's broken and incomplete CSS2. */
362 div.sidebar-content {
363 background: #ffffee;
364 border: 1px solid silver;
365 padding: 0.5em;
367 div.sidebar-title, div.image-title {
368 color: #527bbd;
369 font-family: sans-serif;
370 font-weight: bold;
371 margin-top: 0.0em;
372 margin-bottom: 0.5em;
375 div.listingblock div.content {
376 border: 1px solid silver;
377 background: #f4f4f4;
378 padding: 0.5em;
381 div.quoteblock-attribution {
382 padding-top: 0.5em;
383 text-align: right;
386 div.verseblock-content {
387 white-space: pre;
389 div.verseblock-attribution {
390 padding-top: 0.75em;
391 text-align: left;
394 div.exampleblock-content {
395 border-left: 2px solid silver;
396 padding-left: 0.5em;
399 /* IE6 sets dynamically generated links as visited. */
400 div#toc a:visited { color: blue; }
401 </style>
402 </head>
403 <body>
404 <div id="header">
405 <h1>
406 git-fetch(1) Manual Page
407 </h1>
408 <h2>NAME</h2>
409 <div class="sectionbody">
410 <p>git-fetch -
411 Download objects and refs from another repository
412 </p>
413 </div>
414 </div>
415 <h2 id="_synopsis">SYNOPSIS</h2>
416 <div class="sectionbody">
417 <div class="paragraph"><p><em>git fetch</em> [&lt;options&gt;] [&lt;repository&gt; [&lt;refspec&gt;&#8230;]]</p></div>
418 <div class="paragraph"><p><em>git fetch</em> [&lt;options&gt;] &lt;group&gt;</p></div>
419 <div class="paragraph"><p><em>git fetch</em> --multiple [&lt;options&gt;] [(&lt;repository&gt; | &lt;group&gt;)&#8230;]</p></div>
420 <div class="paragraph"><p><em>git fetch</em> --all [&lt;options&gt;]</p></div>
421 </div>
422 <h2 id="_description">DESCRIPTION</h2>
423 <div class="sectionbody">
424 <div class="paragraph"><p>Fetches named heads or tags from one or more other repositories,
425 along with the objects necessary to complete them.</p></div>
426 <div class="paragraph"><p>The ref names and their object names of fetched refs are stored
427 in <tt>.git/FETCH_HEAD</tt>. This information is left for a later merge
428 operation done by <em>git merge</em>.</p></div>
429 <div class="paragraph"><p>When &lt;refspec&gt; stores the fetched result in remote-tracking branches,
430 the tags that point at these branches are automatically
431 followed. This is done by first fetching from the remote using
432 the given &lt;refspec&gt;s, and if the repository has objects that are
433 pointed by remote tags that it does not yet have, then fetch
434 those missing tags. If the other end has tags that point at
435 branches you are not interested in, you will not get them.</p></div>
436 <div class="paragraph"><p><em>git fetch</em> can fetch from either a single named repository,
437 or from several repositories at once if &lt;group&gt; is given and
438 there is a remotes.&lt;group&gt; entry in the configuration file.
439 (See <a href="git-config.html">git-config(1)</a>).</p></div>
440 </div>
441 <h2 id="_options">OPTIONS</h2>
442 <div class="sectionbody">
443 <div class="dlist"><dl>
444 <dt class="hdlist1">
445 --all
446 </dt>
447 <dd>
449 Fetch all remotes.
450 </p>
451 </dd>
452 <dt class="hdlist1">
454 </dt>
455 <dt class="hdlist1">
456 --append
457 </dt>
458 <dd>
460 Append ref names and object names of fetched refs to the
461 existing contents of <tt>.git/FETCH_HEAD</tt>. Without this
462 option old data in <tt>.git/FETCH_HEAD</tt> will be overwritten.
463 </p>
464 </dd>
465 <dt class="hdlist1">
466 --depth=&lt;depth&gt;
467 </dt>
468 <dd>
470 Deepen the history of a <em>shallow</em> repository created by
471 <tt>git clone</tt> with <tt>--depth=&lt;depth&gt;</tt> option (see <a href="git-clone.html">git-clone(1)</a>)
472 by the specified number of commits.
473 </p>
474 </dd>
475 <dt class="hdlist1">
476 --dry-run
477 </dt>
478 <dd>
480 Show what would be done, without making any changes.
481 </p>
482 </dd>
483 <dt class="hdlist1">
485 </dt>
486 <dt class="hdlist1">
487 --force
488 </dt>
489 <dd>
491 When <em>git fetch</em> is used with <tt>&lt;rbranch&gt;:&lt;lbranch&gt;</tt>
492 refspec, it refuses to update the local branch
493 <tt>&lt;lbranch&gt;</tt> unless the remote branch <tt>&lt;rbranch&gt;</tt> it
494 fetches is a descendant of <tt>&lt;lbranch&gt;</tt>. This option
495 overrides that check.
496 </p>
497 </dd>
498 <dt class="hdlist1">
500 </dt>
501 <dt class="hdlist1">
502 --keep
503 </dt>
504 <dd>
506 Keep downloaded pack.
507 </p>
508 </dd>
509 <dt class="hdlist1">
510 --multiple
511 </dt>
512 <dd>
514 Allow several &lt;repository&gt; and &lt;group&gt; arguments to be
515 specified. No &lt;refspec&gt;s may be specified.
516 </p>
517 </dd>
518 <dt class="hdlist1">
520 </dt>
521 <dt class="hdlist1">
522 --prune
523 </dt>
524 <dd>
526 After fetching, remove any remote-tracking branches which
527 no longer exist on the remote.
528 </p>
529 </dd>
530 <dt class="hdlist1">
532 </dt>
533 <dt class="hdlist1">
534 --no-tags
535 </dt>
536 <dd>
538 By default, tags that point at objects that are downloaded
539 from the remote repository are fetched and stored locally.
540 This option disables this automatic tag following. The default
541 behavior for a remote may be specified with the remote.&lt;name&gt;.tagopt
542 setting. See <a href="git-config.html">git-config(1)</a>.
543 </p>
544 </dd>
545 <dt class="hdlist1">
547 </dt>
548 <dt class="hdlist1">
549 --tags
550 </dt>
551 <dd>
553 Most of the tags are fetched automatically as branch
554 heads are downloaded, but tags that do not point at
555 objects reachable from the branch heads that are being
556 tracked will not be fetched by this mechanism. This
557 flag lets all tags and their associated objects be
558 downloaded. The default behavior for a remote may be
559 specified with the remote.&lt;name&gt;.tagopt setting. See
560 <a href="git-config.html">git-config(1)</a>.
561 </p>
562 </dd>
563 <dt class="hdlist1">
564 --recurse-submodules[=yes|on-demand|no]
565 </dt>
566 <dd>
568 This option controls if and under what conditions new commits of
569 populated submodules should be fetched too. It can be used as a
570 boolean option to completely disable recursion when set to <em>no</em> or to
571 unconditionally recurse into all populated submodules when set to
572 <em>yes</em>, which is the default when this option is used without any
573 value. Use <em>on-demand</em> to only recurse into a populated submodule
574 when the superproject retrieves a commit that updates the submodule&#8217;s
575 reference to a commit that isn&#8217;t already in the local submodule
576 clone.
577 </p>
578 </dd>
579 <dt class="hdlist1">
580 --no-recurse-submodules
581 </dt>
582 <dd>
584 Disable recursive fetching of submodules (this has the same effect as
585 using the <em>--recurse-submodules=no</em> option).
586 </p>
587 </dd>
588 <dt class="hdlist1">
589 --submodule-prefix=&lt;path&gt;
590 </dt>
591 <dd>
593 Prepend &lt;path&gt; to paths printed in informative messages
594 such as "Fetching submodule foo". This option is used
595 internally when recursing over submodules.
596 </p>
597 </dd>
598 <dt class="hdlist1">
599 --recurse-submodules-default=[yes|on-demand]
600 </dt>
601 <dd>
603 This option is used internally to temporarily provide a
604 non-negative default value for the --recurse-submodules
605 option. All other methods of configuring fetch&#8217;s submodule
606 recursion (such as settings in <a href="gitmodules.html">gitmodules(5)</a> and
607 <a href="git-config.html">git-config(1)</a>) override this option, as does
608 specifying --[no-]recurse-submodules directly.
609 </p>
610 </dd>
611 <dt class="hdlist1">
613 </dt>
614 <dt class="hdlist1">
615 --update-head-ok
616 </dt>
617 <dd>
619 By default <em>git fetch</em> refuses to update the head which
620 corresponds to the current branch. This flag disables the
621 check. This is purely for the internal use for <em>git pull</em>
622 to communicate with <em>git fetch</em>, and unless you are
623 implementing your own Porcelain you are not supposed to
624 use it.
625 </p>
626 </dd>
627 <dt class="hdlist1">
628 --upload-pack &lt;upload-pack&gt;
629 </dt>
630 <dd>
632 When given, and the repository to fetch from is handled
633 by <em>git fetch-pack</em>, <em>--exec=&lt;upload-pack&gt;</em> is passed to
634 the command to specify non-default path for the command
635 run on the other end.
636 </p>
637 </dd>
638 <dt class="hdlist1">
640 </dt>
641 <dt class="hdlist1">
642 --quiet
643 </dt>
644 <dd>
646 Pass --quiet to git-fetch-pack and silence any other internally
647 used git commands. Progress is not reported to the standard error
648 stream.
649 </p>
650 </dd>
651 <dt class="hdlist1">
653 </dt>
654 <dt class="hdlist1">
655 --verbose
656 </dt>
657 <dd>
659 Be verbose.
660 </p>
661 </dd>
662 <dt class="hdlist1">
663 --progress
664 </dt>
665 <dd>
667 Progress status is reported on the standard error stream
668 by default when it is attached to a terminal, unless -q
669 is specified. This flag forces progress status even if the
670 standard error stream is not directed to a terminal.
671 </p>
672 </dd>
673 <dt class="hdlist1">
674 &lt;repository&gt;
675 </dt>
676 <dd>
678 The "remote" repository that is the source of a fetch
679 or pull operation. This parameter can be either a URL
680 (see the section <a href="#URLS">GIT URLS</a> below) or the name
681 of a remote (see the section <a href="#REMOTES">REMOTES</a> below).
682 </p>
683 </dd>
684 <dt class="hdlist1">
685 &lt;group&gt;
686 </dt>
687 <dd>
689 A name referring to a list of repositories as the value
690 of remotes.&lt;group&gt; in the configuration file.
691 (See <a href="git-config.html">git-config(1)</a>).
692 </p>
693 </dd>
694 <dt class="hdlist1">
695 &lt;refspec&gt;
696 </dt>
697 <dd>
699 The format of a &lt;refspec&gt; parameter is an optional plus
700 <tt>&#43;</tt>, followed by the source ref &lt;src&gt;, followed
701 by a colon <tt>:</tt>, followed by the destination ref &lt;dst&gt;.
702 </p>
703 <div class="paragraph"><p>The remote ref that matches &lt;src&gt;
704 is fetched, and if &lt;dst&gt; is not empty string, the local
705 ref that matches it is fast-forwarded using &lt;src&gt;.
706 If the optional plus <tt>+</tt> is used, the local ref
707 is updated even if it does not result in a fast-forward
708 update.</p></div>
709 <div class="admonitionblock">
710 <table><tr>
711 <td class="icon">
712 <div class="title">Note</div>
713 </td>
714 <td class="content">If the remote branch from which you want to pull is
715 modified in non-linear ways such as being rewound and
716 rebased frequently, then a pull will attempt a merge with
717 an older version of itself, likely conflict, and fail.
718 It is under these conditions that you would want to use
719 the <tt>+</tt> sign to indicate non-fast-forward updates will
720 be needed. There is currently no easy way to determine
721 or declare that a branch will be made available in a
722 repository with this behavior; the pulling user simply
723 must know this is the expected usage pattern for a branch.</td>
724 </tr></table>
725 </div>
726 <div class="admonitionblock">
727 <table><tr>
728 <td class="icon">
729 <div class="title">Note</div>
730 </td>
731 <td class="content">You never do your own development on branches that appear
732 on the right hand side of a &lt;refspec&gt; colon on <tt>Pull:</tt> lines;
733 they are to be updated by <em>git fetch</em>. If you intend to do
734 development derived from a remote branch <tt>B</tt>, have a <tt>Pull:</tt>
735 line to track it (i.e. <tt>Pull: B:remote-B</tt>), and have a separate
736 branch <tt>my-B</tt> to do your development on top of it. The latter
737 is created by <tt>git branch my-B remote-B</tt> (or its equivalent <tt>git
738 checkout -b my-B remote-B</tt>). Run <tt>git fetch</tt> to keep track of
739 the progress of the remote side, and when you see something new
740 on the remote branch, merge it into your development branch with
741 <tt>git pull . remote-B</tt>, while you are on <tt>my-B</tt> branch.</td>
742 </tr></table>
743 </div>
744 <div class="admonitionblock">
745 <table><tr>
746 <td class="icon">
747 <div class="title">Note</div>
748 </td>
749 <td class="content">There is a difference between listing multiple &lt;refspec&gt;
750 directly on <em>git pull</em> command line and having multiple
751 <tt>Pull:</tt> &lt;refspec&gt; lines for a &lt;repository&gt; and running
752 <em>git pull</em> command without any explicit &lt;refspec&gt; parameters.
753 &lt;refspec&gt; listed explicitly on the command line are always
754 merged into the current branch after fetching. In other words,
755 if you list more than one remote refs, you would be making
756 an Octopus. While <em>git pull</em> run without any explicit &lt;refspec&gt;
757 parameter takes default &lt;refspec&gt;s from <tt>Pull:</tt> lines, it
758 merges only the first &lt;refspec&gt; found into the current branch,
759 after fetching all the remote refs. This is because making an
760 Octopus from remote refs is rarely done, while keeping track
761 of multiple remote heads in one-go by fetching more than one
762 is often useful.</td>
763 </tr></table>
764 </div>
765 <div class="paragraph"><p>Some short-cut notations are also supported.</p></div>
766 <div class="ulist"><ul>
767 <li>
769 <tt>tag &lt;tag&gt;</tt> means the same as <tt>refs/tags/&lt;tag&gt;:refs/tags/&lt;tag&gt;</tt>;
770 it requests fetching everything up to the given tag.
771 </p>
772 </li>
773 <li>
775 A parameter &lt;ref&gt; without a colon is equivalent to
776 &lt;ref&gt;: when pulling/fetching, so it merges &lt;ref&gt; into the current
777 branch without storing the remote branch anywhere locally
778 </p>
779 </li>
780 </ul></div>
781 </dd>
782 </dl></div>
783 </div>
784 <h2 id="_git_urls_a_id_urls_a">GIT URLS<a id="URLS"></a></h2>
785 <div class="sectionbody">
786 <div class="paragraph"><p>In general, URLs contain information about the transport protocol, the
787 address of the remote server, and the path to the repository.
788 Depending on the transport protocol, some of this information may be
789 absent.</p></div>
790 <div class="paragraph"><p>Git natively supports ssh, git, http, https, ftp, ftps, and rsync
791 protocols. The following syntaxes may be used with them:</p></div>
792 <div class="ulist"><ul>
793 <li>
795 ssh://&#91;user@&#93;host.xz&#91;:port&#93;/path/to/repo.git/
796 </p>
797 </li>
798 <li>
800 git://host.xz&#91;:port&#93;/path/to/repo.git/
801 </p>
802 </li>
803 <li>
805 http&#91;s&#93;://host.xz&#91;:port&#93;/path/to/repo.git/
806 </p>
807 </li>
808 <li>
810 ftp&#91;s&#93;://host.xz&#91;:port&#93;/path/to/repo.git/
811 </p>
812 </li>
813 <li>
815 rsync://host.xz/path/to/repo.git/
816 </p>
817 </li>
818 </ul></div>
819 <div class="paragraph"><p>An alternative scp-like syntax may also be used with the ssh protocol:</p></div>
820 <div class="ulist"><ul>
821 <li>
823 &#91;user@&#93;host.xz:path/to/repo.git/
824 </p>
825 </li>
826 </ul></div>
827 <div class="paragraph"><p>The ssh and git protocols additionally support ~username expansion:</p></div>
828 <div class="ulist"><ul>
829 <li>
831 ssh://&#91;user@&#93;host.xz&#91;:port&#93;/~&#91;user&#93;/path/to/repo.git/
832 </p>
833 </li>
834 <li>
836 git://host.xz&#91;:port&#93;/~&#91;user&#93;/path/to/repo.git/
837 </p>
838 </li>
839 <li>
841 &#91;user@&#93;host.xz:/~&#91;user&#93;/path/to/repo.git/
842 </p>
843 </li>
844 </ul></div>
845 <div class="paragraph"><p>For local repositories, also supported by git natively, the following
846 syntaxes may be used:</p></div>
847 <div class="ulist"><ul>
848 <li>
850 /path/to/repo.git/
851 </p>
852 </li>
853 <li>
855 <a href="file:///path/to/repo.git/">file:///path/to/repo.git/</a>
856 </p>
857 </li>
858 </ul></div>
859 <div class="paragraph"><p>These two syntaxes are mostly equivalent, except when cloning, when
860 the former implies --local option. See <a href="git-clone.html">git-clone(1)</a> for
861 details.</p></div>
862 <div class="paragraph"><p>When git doesn&#8217;t know how to handle a certain transport protocol, it
863 attempts to use the <em>remote-&lt;transport&gt;</em> remote helper, if one
864 exists. To explicitly request a remote helper, the following syntax
865 may be used:</p></div>
866 <div class="ulist"><ul>
867 <li>
869 &lt;transport&gt;::&lt;address&gt;
870 </p>
871 </li>
872 </ul></div>
873 <div class="paragraph"><p>where &lt;address&gt; may be a path, a server and path, or an arbitrary
874 URL-like string recognized by the specific remote helper being
875 invoked. See <a href="git-remote-helpers.html">git-remote-helpers(1)</a> for details.</p></div>
876 <div class="paragraph"><p>If there are a large number of similarly-named remote repositories and
877 you want to use a different format for them (such that the URLs you
878 use will be rewritten into URLs that work), you can create a
879 configuration section of the form:</p></div>
880 <div class="listingblock">
881 <div class="content">
882 <pre><tt> [url "&lt;actual url base&gt;"]
883 insteadOf = &lt;other url base&gt;</tt></pre>
884 </div></div>
885 <div class="paragraph"><p>For example, with this:</p></div>
886 <div class="listingblock">
887 <div class="content">
888 <pre><tt> [url "git://git.host.xz/"]
889 insteadOf = host.xz:/path/to/
890 insteadOf = work:</tt></pre>
891 </div></div>
892 <div class="paragraph"><p>a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be
893 rewritten in any context that takes a URL to be "git://git.host.xz/repo.git".</p></div>
894 <div class="paragraph"><p>If you want to rewrite URLs for push only, you can create a
895 configuration section of the form:</p></div>
896 <div class="listingblock">
897 <div class="content">
898 <pre><tt> [url "&lt;actual url base&gt;"]
899 pushInsteadOf = &lt;other url base&gt;</tt></pre>
900 </div></div>
901 <div class="paragraph"><p>For example, with this:</p></div>
902 <div class="listingblock">
903 <div class="content">
904 <pre><tt> [url "ssh://example.org/"]
905 pushInsteadOf = git://example.org/</tt></pre>
906 </div></div>
907 <div class="paragraph"><p>a URL like "git://example.org/path/to/repo.git" will be rewritten to
908 "ssh://example.org/path/to/repo.git" for pushes, but pulls will still
909 use the original URL.</p></div>
910 </div>
911 <h2 id="_remotes_a_id_remotes_a">REMOTES<a id="REMOTES"></a></h2>
912 <div class="sectionbody">
913 <div class="paragraph"><p>The name of one of the following can be used instead
914 of a URL as <tt>&lt;repository&gt;</tt> argument:</p></div>
915 <div class="ulist"><ul>
916 <li>
918 a remote in the git configuration file: <tt>$GIT_DIR/config</tt>,
919 </p>
920 </li>
921 <li>
923 a file in the <tt>$GIT_DIR/remotes</tt> directory, or
924 </p>
925 </li>
926 <li>
928 a file in the <tt>$GIT_DIR/branches</tt> directory.
929 </p>
930 </li>
931 </ul></div>
932 <div class="paragraph"><p>All of these also allow you to omit the refspec from the command line
933 because they each contain a refspec which git will use by default.</p></div>
934 <h3 id="_named_remote_in_configuration_file">Named remote in configuration file</h3><div style="clear:left"></div>
935 <div class="paragraph"><p>You can choose to provide the name of a remote which you had previously
936 configured using <a href="git-remote.html">git-remote(1)</a>, <a href="git-config.html">git-config(1)</a>
937 or even by a manual edit to the <tt>$GIT_DIR/config</tt> file. The URL of
938 this remote will be used to access the repository. The refspec
939 of this remote will be used by default when you do
940 not provide a refspec on the command line. The entry in the
941 config file would appear like this:</p></div>
942 <div class="listingblock">
943 <div class="content">
944 <pre><tt> [remote "&lt;name&gt;"]
945 url = &lt;url&gt;
946 pushurl = &lt;pushurl&gt;
947 push = &lt;refspec&gt;
948 fetch = &lt;refspec&gt;</tt></pre>
949 </div></div>
950 <div class="paragraph"><p>The <tt>&lt;pushurl&gt;</tt> is used for pushes only. It is optional and defaults
951 to <tt>&lt;url&gt;</tt>.</p></div>
952 <h3 id="_named_file_in_tt_git_dir_remotes_tt">Named file in <tt>$GIT_DIR/remotes</tt></h3><div style="clear:left"></div>
953 <div class="paragraph"><p>You can choose to provide the name of a
954 file in <tt>$GIT_DIR/remotes</tt>. The URL
955 in this file will be used to access the repository. The refspec
956 in this file will be used as default when you do not
957 provide a refspec on the command line. This file should have the
958 following format:</p></div>
959 <div class="listingblock">
960 <div class="content">
961 <pre><tt> URL: one of the above URL format
962 Push: &lt;refspec&gt;
963 Pull: &lt;refspec&gt;</tt></pre>
964 </div></div>
965 <div class="paragraph"><p><tt>Push:</tt> lines are used by <em>git push</em> and
966 <tt>Pull:</tt> lines are used by <em>git pull</em> and <em>git fetch</em>.
967 Multiple <tt>Push:</tt> and <tt>Pull:</tt> lines may
968 be specified for additional branch mappings.</p></div>
969 <h3 id="_named_file_in_tt_git_dir_branches_tt">Named file in <tt>$GIT_DIR/branches</tt></h3><div style="clear:left"></div>
970 <div class="paragraph"><p>You can choose to provide the name of a
971 file in <tt>$GIT_DIR/branches</tt>.
972 The URL in this file will be used to access the repository.
973 This file should have the following format:</p></div>
974 <div class="listingblock">
975 <div class="content">
976 <pre><tt> &lt;url&gt;#&lt;head&gt;</tt></pre>
977 </div></div>
978 <div class="paragraph"><p><tt>&lt;url&gt;</tt> is required; <tt>#&lt;head&gt;</tt> is optional.</p></div>
979 <div class="paragraph"><p>Depending on the operation, git will use one of the following
980 refspecs, if you don&#8217;t provide one on the command line.
981 <tt>&lt;branch&gt;</tt> is the name of this file in <tt>$GIT_DIR/branches</tt> and
982 <tt>&lt;head&gt;</tt> defaults to <tt>master</tt>.</p></div>
983 <div class="paragraph"><p>git fetch uses:</p></div>
984 <div class="listingblock">
985 <div class="content">
986 <pre><tt> refs/heads/&lt;head&gt;:refs/heads/&lt;branch&gt;</tt></pre>
987 </div></div>
988 <div class="paragraph"><p>git push uses:</p></div>
989 <div class="listingblock">
990 <div class="content">
991 <pre><tt> HEAD:refs/heads/&lt;head&gt;</tt></pre>
992 </div></div>
993 </div>
994 <h2 id="_examples">EXAMPLES</h2>
995 <div class="sectionbody">
996 <div class="ulist"><ul>
997 <li>
999 Update the remote-tracking branches:
1000 </p>
1001 <div class="listingblock">
1002 <div class="content">
1003 <pre><tt>$ git fetch origin</tt></pre>
1004 </div></div>
1005 <div class="paragraph"><p>The above command copies all branches from the remote refs/heads/
1006 namespace and stores them to the local refs/remotes/origin/ namespace,
1007 unless the branch.&lt;name&gt;.fetch option is used to specify a non-default
1008 refspec.</p></div>
1009 </li>
1010 <li>
1012 Using refspecs explicitly:
1013 </p>
1014 <div class="listingblock">
1015 <div class="content">
1016 <pre><tt>$ git fetch origin +pu:pu maint:tmp</tt></pre>
1017 </div></div>
1018 <div class="paragraph"><p>This updates (or creates, as necessary) branches <tt>pu</tt> and <tt>tmp</tt> in
1019 the local repository by fetching from the branches (respectively)
1020 <tt>pu</tt> and <tt>maint</tt> from the remote repository.</p></div>
1021 <div class="paragraph"><p>The <tt>pu</tt> branch will be updated even if it is does not fast-forward,
1022 because it is prefixed with a plus sign; <tt>tmp</tt> will not be.</p></div>
1023 </li>
1024 </ul></div>
1025 </div>
1026 <h2 id="_bugs">BUGS</h2>
1027 <div class="sectionbody">
1028 <div class="paragraph"><p>Using --recurse-submodules can only fetch new commits in already checked
1029 out submodules right now. When e.g. upstream added a new submodule in the
1030 just fetched commits of the superproject the submodule itself can not be
1031 fetched, making it impossible to check out that submodule later without
1032 having to do a fetch again. This is expected to be fixed in a future git
1033 version.</p></div>
1034 </div>
1035 <h2 id="_see_also">SEE ALSO</h2>
1036 <div class="sectionbody">
1037 <div class="paragraph"><p><a href="git-pull.html">git-pull(1)</a></p></div>
1038 </div>
1039 <h2 id="_git">GIT</h2>
1040 <div class="sectionbody">
1041 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1042 </div>
1043 <div id="footer">
1044 <div id="footer-text">
1045 Last updated 2011-04-13 22:40:02 UTC
1046 </div>
1047 </div>
1048 </body>
1049 </html>