Autogenerated HTML docs for v1.7.6-396-ge0613
[git/jnareb-git.git] / git-fetch.html
blob082029202146e47a9d989c2c9cce1059efbda04c
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="verseblock">
418 <div class="verseblock-content"><em>git fetch</em> [&lt;options&gt;] [&lt;repository&gt; [&lt;refspec&gt;&#8230;]]
419 <em>git fetch</em> [&lt;options&gt;] &lt;group&gt;
420 <em>git fetch</em> --multiple [&lt;options&gt;] [(&lt;repository&gt; | &lt;group&gt;)&#8230;]
421 <em>git fetch</em> --all [&lt;options&gt;]</div>
422 <div class="verseblock-attribution">
423 </div></div>
424 </div>
425 <h2 id="_description">DESCRIPTION</h2>
426 <div class="sectionbody">
427 <div class="paragraph"><p>Fetches named heads or tags from one or more other repositories,
428 along with the objects necessary to complete them.</p></div>
429 <div class="paragraph"><p>The ref names and their object names of fetched refs are stored
430 in <tt>.git/FETCH_HEAD</tt>. This information is left for a later merge
431 operation done by <em>git merge</em>.</p></div>
432 <div class="paragraph"><p>When &lt;refspec&gt; stores the fetched result in remote-tracking branches,
433 the tags that point at these branches are automatically
434 followed. This is done by first fetching from the remote using
435 the given &lt;refspec&gt;s, and if the repository has objects that are
436 pointed by remote tags that it does not yet have, then fetch
437 those missing tags. If the other end has tags that point at
438 branches you are not interested in, you will not get them.</p></div>
439 <div class="paragraph"><p><em>git fetch</em> can fetch from either a single named repository,
440 or from several repositories at once if &lt;group&gt; is given and
441 there is a remotes.&lt;group&gt; entry in the configuration file.
442 (See <a href="git-config.html">git-config(1)</a>).</p></div>
443 </div>
444 <h2 id="_options">OPTIONS</h2>
445 <div class="sectionbody">
446 <div class="dlist"><dl>
447 <dt class="hdlist1">
448 --all
449 </dt>
450 <dd>
452 Fetch all remotes.
453 </p>
454 </dd>
455 <dt class="hdlist1">
457 </dt>
458 <dt class="hdlist1">
459 --append
460 </dt>
461 <dd>
463 Append ref names and object names of fetched refs to the
464 existing contents of <tt>.git/FETCH_HEAD</tt>. Without this
465 option old data in <tt>.git/FETCH_HEAD</tt> will be overwritten.
466 </p>
467 </dd>
468 <dt class="hdlist1">
469 --depth=&lt;depth&gt;
470 </dt>
471 <dd>
473 Deepen the history of a <em>shallow</em> repository created by
474 <tt>git clone</tt> with <tt>--depth=&lt;depth&gt;</tt> option (see <a href="git-clone.html">git-clone(1)</a>)
475 by the specified number of commits.
476 </p>
477 </dd>
478 <dt class="hdlist1">
479 --dry-run
480 </dt>
481 <dd>
483 Show what would be done, without making any changes.
484 </p>
485 </dd>
486 <dt class="hdlist1">
488 </dt>
489 <dt class="hdlist1">
490 --force
491 </dt>
492 <dd>
494 When <em>git fetch</em> is used with <tt>&lt;rbranch&gt;:&lt;lbranch&gt;</tt>
495 refspec, it refuses to update the local branch
496 <tt>&lt;lbranch&gt;</tt> unless the remote branch <tt>&lt;rbranch&gt;</tt> it
497 fetches is a descendant of <tt>&lt;lbranch&gt;</tt>. This option
498 overrides that check.
499 </p>
500 </dd>
501 <dt class="hdlist1">
503 </dt>
504 <dt class="hdlist1">
505 --keep
506 </dt>
507 <dd>
509 Keep downloaded pack.
510 </p>
511 </dd>
512 <dt class="hdlist1">
513 --multiple
514 </dt>
515 <dd>
517 Allow several &lt;repository&gt; and &lt;group&gt; arguments to be
518 specified. No &lt;refspec&gt;s may be specified.
519 </p>
520 </dd>
521 <dt class="hdlist1">
523 </dt>
524 <dt class="hdlist1">
525 --prune
526 </dt>
527 <dd>
529 After fetching, remove any remote-tracking branches which
530 no longer exist on the remote.
531 </p>
532 </dd>
533 <dt class="hdlist1">
535 </dt>
536 <dt class="hdlist1">
537 --no-tags
538 </dt>
539 <dd>
541 By default, tags that point at objects that are downloaded
542 from the remote repository are fetched and stored locally.
543 This option disables this automatic tag following. The default
544 behavior for a remote may be specified with the remote.&lt;name&gt;.tagopt
545 setting. See <a href="git-config.html">git-config(1)</a>.
546 </p>
547 </dd>
548 <dt class="hdlist1">
550 </dt>
551 <dt class="hdlist1">
552 --tags
553 </dt>
554 <dd>
556 Most of the tags are fetched automatically as branch
557 heads are downloaded, but tags that do not point at
558 objects reachable from the branch heads that are being
559 tracked will not be fetched by this mechanism. This
560 flag lets all tags and their associated objects be
561 downloaded. The default behavior for a remote may be
562 specified with the remote.&lt;name&gt;.tagopt setting. See
563 <a href="git-config.html">git-config(1)</a>.
564 </p>
565 </dd>
566 <dt class="hdlist1">
567 --recurse-submodules[=yes|on-demand|no]
568 </dt>
569 <dd>
571 This option controls if and under what conditions new commits of
572 populated submodules should be fetched too. It can be used as a
573 boolean option to completely disable recursion when set to <em>no</em> or to
574 unconditionally recurse into all populated submodules when set to
575 <em>yes</em>, which is the default when this option is used without any
576 value. Use <em>on-demand</em> to only recurse into a populated submodule
577 when the superproject retrieves a commit that updates the submodule&#8217;s
578 reference to a commit that isn&#8217;t already in the local submodule
579 clone.
580 </p>
581 </dd>
582 <dt class="hdlist1">
583 --no-recurse-submodules
584 </dt>
585 <dd>
587 Disable recursive fetching of submodules (this has the same effect as
588 using the <em>--recurse-submodules=no</em> option).
589 </p>
590 </dd>
591 <dt class="hdlist1">
592 --submodule-prefix=&lt;path&gt;
593 </dt>
594 <dd>
596 Prepend &lt;path&gt; to paths printed in informative messages
597 such as "Fetching submodule foo". This option is used
598 internally when recursing over submodules.
599 </p>
600 </dd>
601 <dt class="hdlist1">
602 --recurse-submodules-default=[yes|on-demand]
603 </dt>
604 <dd>
606 This option is used internally to temporarily provide a
607 non-negative default value for the --recurse-submodules
608 option. All other methods of configuring fetch&#8217;s submodule
609 recursion (such as settings in <a href="gitmodules.html">gitmodules(5)</a> and
610 <a href="git-config.html">git-config(1)</a>) override this option, as does
611 specifying --[no-]recurse-submodules directly.
612 </p>
613 </dd>
614 <dt class="hdlist1">
616 </dt>
617 <dt class="hdlist1">
618 --update-head-ok
619 </dt>
620 <dd>
622 By default <em>git fetch</em> refuses to update the head which
623 corresponds to the current branch. This flag disables the
624 check. This is purely for the internal use for <em>git pull</em>
625 to communicate with <em>git fetch</em>, and unless you are
626 implementing your own Porcelain you are not supposed to
627 use it.
628 </p>
629 </dd>
630 <dt class="hdlist1">
631 --upload-pack &lt;upload-pack&gt;
632 </dt>
633 <dd>
635 When given, and the repository to fetch from is handled
636 by <em>git fetch-pack</em>, <em>--exec=&lt;upload-pack&gt;</em> is passed to
637 the command to specify non-default path for the command
638 run on the other end.
639 </p>
640 </dd>
641 <dt class="hdlist1">
643 </dt>
644 <dt class="hdlist1">
645 --quiet
646 </dt>
647 <dd>
649 Pass --quiet to git-fetch-pack and silence any other internally
650 used git commands. Progress is not reported to the standard error
651 stream.
652 </p>
653 </dd>
654 <dt class="hdlist1">
656 </dt>
657 <dt class="hdlist1">
658 --verbose
659 </dt>
660 <dd>
662 Be verbose.
663 </p>
664 </dd>
665 <dt class="hdlist1">
666 --progress
667 </dt>
668 <dd>
670 Progress status is reported on the standard error stream
671 by default when it is attached to a terminal, unless -q
672 is specified. This flag forces progress status even if the
673 standard error stream is not directed to a terminal.
674 </p>
675 </dd>
676 <dt class="hdlist1">
677 &lt;repository&gt;
678 </dt>
679 <dd>
681 The "remote" repository that is the source of a fetch
682 or pull operation. This parameter can be either a URL
683 (see the section <a href="#URLS">GIT URLS</a> below) or the name
684 of a remote (see the section <a href="#REMOTES">REMOTES</a> below).
685 </p>
686 </dd>
687 <dt class="hdlist1">
688 &lt;group&gt;
689 </dt>
690 <dd>
692 A name referring to a list of repositories as the value
693 of remotes.&lt;group&gt; in the configuration file.
694 (See <a href="git-config.html">git-config(1)</a>).
695 </p>
696 </dd>
697 <dt class="hdlist1">
698 &lt;refspec&gt;
699 </dt>
700 <dd>
702 The format of a &lt;refspec&gt; parameter is an optional plus
703 <tt>&#43;</tt>, followed by the source ref &lt;src&gt;, followed
704 by a colon <tt>:</tt>, followed by the destination ref &lt;dst&gt;.
705 </p>
706 <div class="paragraph"><p>The remote ref that matches &lt;src&gt;
707 is fetched, and if &lt;dst&gt; is not empty string, the local
708 ref that matches it is fast-forwarded using &lt;src&gt;.
709 If the optional plus <tt>+</tt> is used, the local ref
710 is updated even if it does not result in a fast-forward
711 update.</p></div>
712 <div class="admonitionblock">
713 <table><tr>
714 <td class="icon">
715 <div class="title">Note</div>
716 </td>
717 <td class="content">If the remote branch from which you want to pull is
718 modified in non-linear ways such as being rewound and
719 rebased frequently, then a pull will attempt a merge with
720 an older version of itself, likely conflict, and fail.
721 It is under these conditions that you would want to use
722 the <tt>+</tt> sign to indicate non-fast-forward updates will
723 be needed. There is currently no easy way to determine
724 or declare that a branch will be made available in a
725 repository with this behavior; the pulling user simply
726 must know this is the expected usage pattern for a branch.</td>
727 </tr></table>
728 </div>
729 <div class="admonitionblock">
730 <table><tr>
731 <td class="icon">
732 <div class="title">Note</div>
733 </td>
734 <td class="content">You never do your own development on branches that appear
735 on the right hand side of a &lt;refspec&gt; colon on <tt>Pull:</tt> lines;
736 they are to be updated by <em>git fetch</em>. If you intend to do
737 development derived from a remote branch <tt>B</tt>, have a <tt>Pull:</tt>
738 line to track it (i.e. <tt>Pull: B:remote-B</tt>), and have a separate
739 branch <tt>my-B</tt> to do your development on top of it. The latter
740 is created by <tt>git branch my-B remote-B</tt> (or its equivalent <tt>git
741 checkout -b my-B remote-B</tt>). Run <tt>git fetch</tt> to keep track of
742 the progress of the remote side, and when you see something new
743 on the remote branch, merge it into your development branch with
744 <tt>git pull . remote-B</tt>, while you are on <tt>my-B</tt> branch.</td>
745 </tr></table>
746 </div>
747 <div class="admonitionblock">
748 <table><tr>
749 <td class="icon">
750 <div class="title">Note</div>
751 </td>
752 <td class="content">There is a difference between listing multiple &lt;refspec&gt;
753 directly on <em>git pull</em> command line and having multiple
754 <tt>Pull:</tt> &lt;refspec&gt; lines for a &lt;repository&gt; and running
755 <em>git pull</em> command without any explicit &lt;refspec&gt; parameters.
756 &lt;refspec&gt; listed explicitly on the command line are always
757 merged into the current branch after fetching. In other words,
758 if you list more than one remote refs, you would be making
759 an Octopus. While <em>git pull</em> run without any explicit &lt;refspec&gt;
760 parameter takes default &lt;refspec&gt;s from <tt>Pull:</tt> lines, it
761 merges only the first &lt;refspec&gt; found into the current branch,
762 after fetching all the remote refs. This is because making an
763 Octopus from remote refs is rarely done, while keeping track
764 of multiple remote heads in one-go by fetching more than one
765 is often useful.</td>
766 </tr></table>
767 </div>
768 <div class="paragraph"><p>Some short-cut notations are also supported.</p></div>
769 <div class="ulist"><ul>
770 <li>
772 <tt>tag &lt;tag&gt;</tt> means the same as <tt>refs/tags/&lt;tag&gt;:refs/tags/&lt;tag&gt;</tt>;
773 it requests fetching everything up to the given tag.
774 </p>
775 </li>
776 <li>
778 A parameter &lt;ref&gt; without a colon is equivalent to
779 &lt;ref&gt;: when pulling/fetching, so it merges &lt;ref&gt; into the current
780 branch without storing the remote branch anywhere locally
781 </p>
782 </li>
783 </ul></div>
784 </dd>
785 </dl></div>
786 </div>
787 <h2 id="_git_urls_a_id_urls_a">GIT URLS<a id="URLS"></a></h2>
788 <div class="sectionbody">
789 <div class="paragraph"><p>In general, URLs contain information about the transport protocol, the
790 address of the remote server, and the path to the repository.
791 Depending on the transport protocol, some of this information may be
792 absent.</p></div>
793 <div class="paragraph"><p>Git natively supports ssh, git, http, https, ftp, ftps, and rsync
794 protocols. The following syntaxes may be used with them:</p></div>
795 <div class="ulist"><ul>
796 <li>
798 ssh://&#91;user@&#93;host.xz&#91;:port&#93;/path/to/repo.git/
799 </p>
800 </li>
801 <li>
803 git://host.xz&#91;:port&#93;/path/to/repo.git/
804 </p>
805 </li>
806 <li>
808 http&#91;s&#93;://host.xz&#91;:port&#93;/path/to/repo.git/
809 </p>
810 </li>
811 <li>
813 ftp&#91;s&#93;://host.xz&#91;:port&#93;/path/to/repo.git/
814 </p>
815 </li>
816 <li>
818 rsync://host.xz/path/to/repo.git/
819 </p>
820 </li>
821 </ul></div>
822 <div class="paragraph"><p>An alternative scp-like syntax may also be used with the ssh protocol:</p></div>
823 <div class="ulist"><ul>
824 <li>
826 &#91;user@&#93;host.xz:path/to/repo.git/
827 </p>
828 </li>
829 </ul></div>
830 <div class="paragraph"><p>The ssh and git protocols additionally support ~username expansion:</p></div>
831 <div class="ulist"><ul>
832 <li>
834 ssh://&#91;user@&#93;host.xz&#91;:port&#93;/~&#91;user&#93;/path/to/repo.git/
835 </p>
836 </li>
837 <li>
839 git://host.xz&#91;:port&#93;/~&#91;user&#93;/path/to/repo.git/
840 </p>
841 </li>
842 <li>
844 &#91;user@&#93;host.xz:/~&#91;user&#93;/path/to/repo.git/
845 </p>
846 </li>
847 </ul></div>
848 <div class="paragraph"><p>For local repositories, also supported by git natively, the following
849 syntaxes may be used:</p></div>
850 <div class="ulist"><ul>
851 <li>
853 /path/to/repo.git/
854 </p>
855 </li>
856 <li>
858 <a href="file:///path/to/repo.git/">file:///path/to/repo.git/</a>
859 </p>
860 </li>
861 </ul></div>
862 <div class="paragraph"><p>These two syntaxes are mostly equivalent, except when cloning, when
863 the former implies --local option. See <a href="git-clone.html">git-clone(1)</a> for
864 details.</p></div>
865 <div class="paragraph"><p>When git doesn&#8217;t know how to handle a certain transport protocol, it
866 attempts to use the <em>remote-&lt;transport&gt;</em> remote helper, if one
867 exists. To explicitly request a remote helper, the following syntax
868 may be used:</p></div>
869 <div class="ulist"><ul>
870 <li>
872 &lt;transport&gt;::&lt;address&gt;
873 </p>
874 </li>
875 </ul></div>
876 <div class="paragraph"><p>where &lt;address&gt; may be a path, a server and path, or an arbitrary
877 URL-like string recognized by the specific remote helper being
878 invoked. See <a href="git-remote-helpers.html">git-remote-helpers(1)</a> for details.</p></div>
879 <div class="paragraph"><p>If there are a large number of similarly-named remote repositories and
880 you want to use a different format for them (such that the URLs you
881 use will be rewritten into URLs that work), you can create a
882 configuration section of the form:</p></div>
883 <div class="listingblock">
884 <div class="content">
885 <pre><tt> [url "&lt;actual url base&gt;"]
886 insteadOf = &lt;other url base&gt;</tt></pre>
887 </div></div>
888 <div class="paragraph"><p>For example, with this:</p></div>
889 <div class="listingblock">
890 <div class="content">
891 <pre><tt> [url "git://git.host.xz/"]
892 insteadOf = host.xz:/path/to/
893 insteadOf = work:</tt></pre>
894 </div></div>
895 <div class="paragraph"><p>a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be
896 rewritten in any context that takes a URL to be "git://git.host.xz/repo.git".</p></div>
897 <div class="paragraph"><p>If you want to rewrite URLs for push only, you can create a
898 configuration section of the form:</p></div>
899 <div class="listingblock">
900 <div class="content">
901 <pre><tt> [url "&lt;actual url base&gt;"]
902 pushInsteadOf = &lt;other url base&gt;</tt></pre>
903 </div></div>
904 <div class="paragraph"><p>For example, with this:</p></div>
905 <div class="listingblock">
906 <div class="content">
907 <pre><tt> [url "ssh://example.org/"]
908 pushInsteadOf = git://example.org/</tt></pre>
909 </div></div>
910 <div class="paragraph"><p>a URL like "git://example.org/path/to/repo.git" will be rewritten to
911 "ssh://example.org/path/to/repo.git" for pushes, but pulls will still
912 use the original URL.</p></div>
913 </div>
914 <h2 id="_remotes_a_id_remotes_a">REMOTES<a id="REMOTES"></a></h2>
915 <div class="sectionbody">
916 <div class="paragraph"><p>The name of one of the following can be used instead
917 of a URL as <tt>&lt;repository&gt;</tt> argument:</p></div>
918 <div class="ulist"><ul>
919 <li>
921 a remote in the git configuration file: <tt>$GIT_DIR/config</tt>,
922 </p>
923 </li>
924 <li>
926 a file in the <tt>$GIT_DIR/remotes</tt> directory, or
927 </p>
928 </li>
929 <li>
931 a file in the <tt>$GIT_DIR/branches</tt> directory.
932 </p>
933 </li>
934 </ul></div>
935 <div class="paragraph"><p>All of these also allow you to omit the refspec from the command line
936 because they each contain a refspec which git will use by default.</p></div>
937 <h3 id="_named_remote_in_configuration_file">Named remote in configuration file</h3><div style="clear:left"></div>
938 <div class="paragraph"><p>You can choose to provide the name of a remote which you had previously
939 configured using <a href="git-remote.html">git-remote(1)</a>, <a href="git-config.html">git-config(1)</a>
940 or even by a manual edit to the <tt>$GIT_DIR/config</tt> file. The URL of
941 this remote will be used to access the repository. The refspec
942 of this remote will be used by default when you do
943 not provide a refspec on the command line. The entry in the
944 config file would appear like this:</p></div>
945 <div class="listingblock">
946 <div class="content">
947 <pre><tt> [remote "&lt;name&gt;"]
948 url = &lt;url&gt;
949 pushurl = &lt;pushurl&gt;
950 push = &lt;refspec&gt;
951 fetch = &lt;refspec&gt;</tt></pre>
952 </div></div>
953 <div class="paragraph"><p>The <tt>&lt;pushurl&gt;</tt> is used for pushes only. It is optional and defaults
954 to <tt>&lt;url&gt;</tt>.</p></div>
955 <h3 id="_named_file_in_tt_git_dir_remotes_tt">Named file in <tt>$GIT_DIR/remotes</tt></h3><div style="clear:left"></div>
956 <div class="paragraph"><p>You can choose to provide the name of a
957 file in <tt>$GIT_DIR/remotes</tt>. The URL
958 in this file will be used to access the repository. The refspec
959 in this file will be used as default when you do not
960 provide a refspec on the command line. This file should have the
961 following format:</p></div>
962 <div class="listingblock">
963 <div class="content">
964 <pre><tt> URL: one of the above URL format
965 Push: &lt;refspec&gt;
966 Pull: &lt;refspec&gt;</tt></pre>
967 </div></div>
968 <div class="paragraph"><p><tt>Push:</tt> lines are used by <em>git push</em> and
969 <tt>Pull:</tt> lines are used by <em>git pull</em> and <em>git fetch</em>.
970 Multiple <tt>Push:</tt> and <tt>Pull:</tt> lines may
971 be specified for additional branch mappings.</p></div>
972 <h3 id="_named_file_in_tt_git_dir_branches_tt">Named file in <tt>$GIT_DIR/branches</tt></h3><div style="clear:left"></div>
973 <div class="paragraph"><p>You can choose to provide the name of a
974 file in <tt>$GIT_DIR/branches</tt>.
975 The URL in this file will be used to access the repository.
976 This file should have the following format:</p></div>
977 <div class="listingblock">
978 <div class="content">
979 <pre><tt> &lt;url&gt;#&lt;head&gt;</tt></pre>
980 </div></div>
981 <div class="paragraph"><p><tt>&lt;url&gt;</tt> is required; <tt>#&lt;head&gt;</tt> is optional.</p></div>
982 <div class="paragraph"><p>Depending on the operation, git will use one of the following
983 refspecs, if you don&#8217;t provide one on the command line.
984 <tt>&lt;branch&gt;</tt> is the name of this file in <tt>$GIT_DIR/branches</tt> and
985 <tt>&lt;head&gt;</tt> defaults to <tt>master</tt>.</p></div>
986 <div class="paragraph"><p>git fetch uses:</p></div>
987 <div class="listingblock">
988 <div class="content">
989 <pre><tt> refs/heads/&lt;head&gt;:refs/heads/&lt;branch&gt;</tt></pre>
990 </div></div>
991 <div class="paragraph"><p>git push uses:</p></div>
992 <div class="listingblock">
993 <div class="content">
994 <pre><tt> HEAD:refs/heads/&lt;head&gt;</tt></pre>
995 </div></div>
996 </div>
997 <h2 id="_examples">EXAMPLES</h2>
998 <div class="sectionbody">
999 <div class="ulist"><ul>
1000 <li>
1002 Update the remote-tracking branches:
1003 </p>
1004 <div class="listingblock">
1005 <div class="content">
1006 <pre><tt>$ git fetch origin</tt></pre>
1007 </div></div>
1008 <div class="paragraph"><p>The above command copies all branches from the remote refs/heads/
1009 namespace and stores them to the local refs/remotes/origin/ namespace,
1010 unless the branch.&lt;name&gt;.fetch option is used to specify a non-default
1011 refspec.</p></div>
1012 </li>
1013 <li>
1015 Using refspecs explicitly:
1016 </p>
1017 <div class="listingblock">
1018 <div class="content">
1019 <pre><tt>$ git fetch origin +pu:pu maint:tmp</tt></pre>
1020 </div></div>
1021 <div class="paragraph"><p>This updates (or creates, as necessary) branches <tt>pu</tt> and <tt>tmp</tt> in
1022 the local repository by fetching from the branches (respectively)
1023 <tt>pu</tt> and <tt>maint</tt> from the remote repository.</p></div>
1024 <div class="paragraph"><p>The <tt>pu</tt> branch will be updated even if it is does not fast-forward,
1025 because it is prefixed with a plus sign; <tt>tmp</tt> will not be.</p></div>
1026 </li>
1027 </ul></div>
1028 </div>
1029 <h2 id="_bugs">BUGS</h2>
1030 <div class="sectionbody">
1031 <div class="paragraph"><p>Using --recurse-submodules can only fetch new commits in already checked
1032 out submodules right now. When e.g. upstream added a new submodule in the
1033 just fetched commits of the superproject the submodule itself can not be
1034 fetched, making it impossible to check out that submodule later without
1035 having to do a fetch again. This is expected to be fixed in a future git
1036 version.</p></div>
1037 </div>
1038 <h2 id="_see_also">SEE ALSO</h2>
1039 <div class="sectionbody">
1040 <div class="paragraph"><p><a href="git-pull.html">git-pull(1)</a></p></div>
1041 </div>
1042 <h2 id="_git">GIT</h2>
1043 <div class="sectionbody">
1044 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1045 </div>
1046 <div id="footer">
1047 <div id="footer-text">
1048 Last updated 2011-07-23 00:49:30 UTC
1049 </div>
1050 </div>
1051 </body>
1052 </html>