Autogenerated HTML docs for v1.7.4-rc2-20-g8c0db6
[git/jnareb-git.git] / git-fetch.html
blob2f78043d4ff5506b3ebadf8eab7991a6524e16b6
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, or
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 --[no-]recurse-submodules
565 </dt>
566 <dd>
568 This option controls if new commits of all populated submodules should
569 be fetched too (see <a href="git-config.html">git-config(1)</a> and <a href="gitmodules.html">gitmodules(5)</a>).
570 </p>
571 </dd>
572 <dt class="hdlist1">
573 --submodule-prefix=&lt;path&gt;
574 </dt>
575 <dd>
577 Prepend &lt;path&gt; to paths printed in informative messages
578 such as "Fetching submodule foo". This option is used
579 internally when recursing over submodules.
580 </p>
581 </dd>
582 <dt class="hdlist1">
584 </dt>
585 <dt class="hdlist1">
586 --update-head-ok
587 </dt>
588 <dd>
590 By default <em>git fetch</em> refuses to update the head which
591 corresponds to the current branch. This flag disables the
592 check. This is purely for the internal use for <em>git pull</em>
593 to communicate with <em>git fetch</em>, and unless you are
594 implementing your own Porcelain you are not supposed to
595 use it.
596 </p>
597 </dd>
598 <dt class="hdlist1">
599 --upload-pack &lt;upload-pack&gt;
600 </dt>
601 <dd>
603 When given, and the repository to fetch from is handled
604 by <em>git fetch-pack</em>, <em>--exec=&lt;upload-pack&gt;</em> is passed to
605 the command to specify non-default path for the command
606 run on the other end.
607 </p>
608 </dd>
609 <dt class="hdlist1">
611 </dt>
612 <dt class="hdlist1">
613 --quiet
614 </dt>
615 <dd>
617 Pass --quiet to git-fetch-pack and silence any other internally
618 used git commands. Progress is not reported to the standard error
619 stream.
620 </p>
621 </dd>
622 <dt class="hdlist1">
624 </dt>
625 <dt class="hdlist1">
626 --verbose
627 </dt>
628 <dd>
630 Be verbose.
631 </p>
632 </dd>
633 <dt class="hdlist1">
634 --progress
635 </dt>
636 <dd>
638 Progress status is reported on the standard error stream
639 by default when it is attached to a terminal, unless -q
640 is specified. This flag forces progress status even if the
641 standard error stream is not directed to a terminal.
642 </p>
643 </dd>
644 <dt class="hdlist1">
645 &lt;repository&gt;
646 </dt>
647 <dd>
649 The "remote" repository that is the source of a fetch
650 or pull operation. This parameter can be either a URL
651 (see the section <a href="#URLS">GIT URLS</a> below) or the name
652 of a remote (see the section <a href="#REMOTES">REMOTES</a> below).
653 </p>
654 </dd>
655 <dt class="hdlist1">
656 &lt;group&gt;
657 </dt>
658 <dd>
660 A name referring to a list of repositories as the value
661 of remotes.&lt;group&gt; in the configuration file.
662 (See <a href="git-config.html">git-config(1)</a>).
663 </p>
664 </dd>
665 <dt class="hdlist1">
666 &lt;refspec&gt;
667 </dt>
668 <dd>
670 The format of a &lt;refspec&gt; parameter is an optional plus
671 <tt>&#43;</tt>, followed by the source ref &lt;src&gt;, followed
672 by a colon <tt>:</tt>, followed by the destination ref &lt;dst&gt;.
673 </p>
674 <div class="paragraph"><p>The remote ref that matches &lt;src&gt;
675 is fetched, and if &lt;dst&gt; is not empty string, the local
676 ref that matches it is fast-forwarded using &lt;src&gt;.
677 If the optional plus <tt>+</tt> is used, the local ref
678 is updated even if it does not result in a fast-forward
679 update.</p></div>
680 <div class="admonitionblock">
681 <table><tr>
682 <td class="icon">
683 <div class="title">Note</div>
684 </td>
685 <td class="content">If the remote branch from which you want to pull is
686 modified in non-linear ways such as being rewound and
687 rebased frequently, then a pull will attempt a merge with
688 an older version of itself, likely conflict, and fail.
689 It is under these conditions that you would want to use
690 the <tt>+</tt> sign to indicate non-fast-forward updates will
691 be needed. There is currently no easy way to determine
692 or declare that a branch will be made available in a
693 repository with this behavior; the pulling user simply
694 must know this is the expected usage pattern for a branch.</td>
695 </tr></table>
696 </div>
697 <div class="admonitionblock">
698 <table><tr>
699 <td class="icon">
700 <div class="title">Note</div>
701 </td>
702 <td class="content">You never do your own development on branches that appear
703 on the right hand side of a &lt;refspec&gt; colon on <tt>Pull:</tt> lines;
704 they are to be updated by <em>git fetch</em>. If you intend to do
705 development derived from a remote branch <tt>B</tt>, have a <tt>Pull:</tt>
706 line to track it (i.e. <tt>Pull: B:remote-B</tt>), and have a separate
707 branch <tt>my-B</tt> to do your development on top of it. The latter
708 is created by <tt>git branch my-B remote-B</tt> (or its equivalent <tt>git
709 checkout -b my-B remote-B</tt>). Run <tt>git fetch</tt> to keep track of
710 the progress of the remote side, and when you see something new
711 on the remote branch, merge it into your development branch with
712 <tt>git pull . remote-B</tt>, while you are on <tt>my-B</tt> branch.</td>
713 </tr></table>
714 </div>
715 <div class="admonitionblock">
716 <table><tr>
717 <td class="icon">
718 <div class="title">Note</div>
719 </td>
720 <td class="content">There is a difference between listing multiple &lt;refspec&gt;
721 directly on <em>git pull</em> command line and having multiple
722 <tt>Pull:</tt> &lt;refspec&gt; lines for a &lt;repository&gt; and running
723 <em>git pull</em> command without any explicit &lt;refspec&gt; parameters.
724 &lt;refspec&gt; listed explicitly on the command line are always
725 merged into the current branch after fetching. In other words,
726 if you list more than one remote refs, you would be making
727 an Octopus. While <em>git pull</em> run without any explicit &lt;refspec&gt;
728 parameter takes default &lt;refspec&gt;s from <tt>Pull:</tt> lines, it
729 merges only the first &lt;refspec&gt; found into the current branch,
730 after fetching all the remote refs. This is because making an
731 Octopus from remote refs is rarely done, while keeping track
732 of multiple remote heads in one-go by fetching more than one
733 is often useful.</td>
734 </tr></table>
735 </div>
736 <div class="paragraph"><p>Some short-cut notations are also supported.</p></div>
737 <div class="ulist"><ul>
738 <li>
740 <tt>tag &lt;tag&gt;</tt> means the same as <tt>refs/tags/&lt;tag&gt;:refs/tags/&lt;tag&gt;</tt>;
741 it requests fetching everything up to the given tag.
742 </p>
743 </li>
744 <li>
746 A parameter &lt;ref&gt; without a colon is equivalent to
747 &lt;ref&gt;: when pulling/fetching, so it merges &lt;ref&gt; into the current
748 branch without storing the remote branch anywhere locally
749 </p>
750 </li>
751 </ul></div>
752 </dd>
753 </dl></div>
754 </div>
755 <h2 id="_git_urls_a_id_urls_a">GIT URLS<a id="URLS"></a></h2>
756 <div class="sectionbody">
757 <div class="paragraph"><p>In general, URLs contain information about the transport protocol, the
758 address of the remote server, and the path to the repository.
759 Depending on the transport protocol, some of this information may be
760 absent.</p></div>
761 <div class="paragraph"><p>Git natively supports ssh, git, http, https, ftp, ftps, and rsync
762 protocols. The following syntaxes may be used with them:</p></div>
763 <div class="ulist"><ul>
764 <li>
766 ssh://&#91;user@&#93;host.xz&#91;:port&#93;/path/to/repo.git/
767 </p>
768 </li>
769 <li>
771 git://host.xz&#91;:port&#93;/path/to/repo.git/
772 </p>
773 </li>
774 <li>
776 http&#91;s&#93;://host.xz&#91;:port&#93;/path/to/repo.git/
777 </p>
778 </li>
779 <li>
781 ftp&#91;s&#93;://host.xz&#91;:port&#93;/path/to/repo.git/
782 </p>
783 </li>
784 <li>
786 rsync://host.xz/path/to/repo.git/
787 </p>
788 </li>
789 </ul></div>
790 <div class="paragraph"><p>An alternative scp-like syntax may also be used with the ssh protocol:</p></div>
791 <div class="ulist"><ul>
792 <li>
794 &#91;user@&#93;host.xz:path/to/repo.git/
795 </p>
796 </li>
797 </ul></div>
798 <div class="paragraph"><p>The ssh and git protocols additionally support ~username expansion:</p></div>
799 <div class="ulist"><ul>
800 <li>
802 ssh://&#91;user@&#93;host.xz&#91;:port&#93;/~&#91;user&#93;/path/to/repo.git/
803 </p>
804 </li>
805 <li>
807 git://host.xz&#91;:port&#93;/~&#91;user&#93;/path/to/repo.git/
808 </p>
809 </li>
810 <li>
812 &#91;user@&#93;host.xz:/~&#91;user&#93;/path/to/repo.git/
813 </p>
814 </li>
815 </ul></div>
816 <div class="paragraph"><p>For local repositories, also supported by git natively, the following
817 syntaxes may be used:</p></div>
818 <div class="ulist"><ul>
819 <li>
821 /path/to/repo.git/
822 </p>
823 </li>
824 <li>
826 <a href="file:///path/to/repo.git/">file:///path/to/repo.git/</a>
827 </p>
828 </li>
829 </ul></div>
830 <div class="paragraph"><p>These two syntaxes are mostly equivalent, except when cloning, when
831 the former implies --local option. See <a href="git-clone.html">git-clone(1)</a> for
832 details.</p></div>
833 <div class="paragraph"><p>When git doesn&#8217;t know how to handle a certain transport protocol, it
834 attempts to use the <em>remote-&lt;transport&gt;</em> remote helper, if one
835 exists. To explicitly request a remote helper, the following syntax
836 may be used:</p></div>
837 <div class="ulist"><ul>
838 <li>
840 &lt;transport&gt;::&lt;address&gt;
841 </p>
842 </li>
843 </ul></div>
844 <div class="paragraph"><p>where &lt;address&gt; may be a path, a server and path, or an arbitrary
845 URL-like string recognized by the specific remote helper being
846 invoked. See <a href="git-remote-helpers.html">git-remote-helpers(1)</a> for details.</p></div>
847 <div class="paragraph"><p>If there are a large number of similarly-named remote repositories and
848 you want to use a different format for them (such that the URLs you
849 use will be rewritten into URLs that work), you can create a
850 configuration section of the form:</p></div>
851 <div class="listingblock">
852 <div class="content">
853 <pre><tt> [url "&lt;actual url base&gt;"]
854 insteadOf = &lt;other url base&gt;</tt></pre>
855 </div></div>
856 <div class="paragraph"><p>For example, with this:</p></div>
857 <div class="listingblock">
858 <div class="content">
859 <pre><tt> [url "git://git.host.xz/"]
860 insteadOf = host.xz:/path/to/
861 insteadOf = work:</tt></pre>
862 </div></div>
863 <div class="paragraph"><p>a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be
864 rewritten in any context that takes a URL to be "git://git.host.xz/repo.git".</p></div>
865 <div class="paragraph"><p>If you want to rewrite URLs for push only, you can create a
866 configuration section of the form:</p></div>
867 <div class="listingblock">
868 <div class="content">
869 <pre><tt> [url "&lt;actual url base&gt;"]
870 pushInsteadOf = &lt;other url base&gt;</tt></pre>
871 </div></div>
872 <div class="paragraph"><p>For example, with this:</p></div>
873 <div class="listingblock">
874 <div class="content">
875 <pre><tt> [url "ssh://example.org/"]
876 pushInsteadOf = git://example.org/</tt></pre>
877 </div></div>
878 <div class="paragraph"><p>a URL like "git://example.org/path/to/repo.git" will be rewritten to
879 "ssh://example.org/path/to/repo.git" for pushes, but pulls will still
880 use the original URL.</p></div>
881 </div>
882 <h2 id="_remotes_a_id_remotes_a">REMOTES<a id="REMOTES"></a></h2>
883 <div class="sectionbody">
884 <div class="paragraph"><p>The name of one of the following can be used instead
885 of a URL as <tt>&lt;repository&gt;</tt> argument:</p></div>
886 <div class="ulist"><ul>
887 <li>
889 a remote in the git configuration file: <tt>$GIT_DIR/config</tt>,
890 </p>
891 </li>
892 <li>
894 a file in the <tt>$GIT_DIR/remotes</tt> directory, or
895 </p>
896 </li>
897 <li>
899 a file in the <tt>$GIT_DIR/branches</tt> directory.
900 </p>
901 </li>
902 </ul></div>
903 <div class="paragraph"><p>All of these also allow you to omit the refspec from the command line
904 because they each contain a refspec which git will use by default.</p></div>
905 <h3 id="_named_remote_in_configuration_file">Named remote in configuration file</h3><div style="clear:left"></div>
906 <div class="paragraph"><p>You can choose to provide the name of a remote which you had previously
907 configured using <a href="git-remote.html">git-remote(1)</a>, <a href="git-config.html">git-config(1)</a>
908 or even by a manual edit to the <tt>$GIT_DIR/config</tt> file. The URL of
909 this remote will be used to access the repository. The refspec
910 of this remote will be used by default when you do
911 not provide a refspec on the command line. The entry in the
912 config file would appear like this:</p></div>
913 <div class="listingblock">
914 <div class="content">
915 <pre><tt> [remote "&lt;name&gt;"]
916 url = &lt;url&gt;
917 pushurl = &lt;pushurl&gt;
918 push = &lt;refspec&gt;
919 fetch = &lt;refspec&gt;</tt></pre>
920 </div></div>
921 <div class="paragraph"><p>The <tt>&lt;pushurl&gt;</tt> is used for pushes only. It is optional and defaults
922 to <tt>&lt;url&gt;</tt>.</p></div>
923 <h3 id="_named_file_in_tt_git_dir_remotes_tt">Named file in <tt>$GIT_DIR/remotes</tt></h3><div style="clear:left"></div>
924 <div class="paragraph"><p>You can choose to provide the name of a
925 file in <tt>$GIT_DIR/remotes</tt>. The URL
926 in this file will be used to access the repository. The refspec
927 in this file will be used as default when you do not
928 provide a refspec on the command line. This file should have the
929 following format:</p></div>
930 <div class="listingblock">
931 <div class="content">
932 <pre><tt> URL: one of the above URL format
933 Push: &lt;refspec&gt;
934 Pull: &lt;refspec&gt;</tt></pre>
935 </div></div>
936 <div class="paragraph"><p><tt>Push:</tt> lines are used by <em>git push</em> and
937 <tt>Pull:</tt> lines are used by <em>git pull</em> and <em>git fetch</em>.
938 Multiple <tt>Push:</tt> and <tt>Pull:</tt> lines may
939 be specified for additional branch mappings.</p></div>
940 <h3 id="_named_file_in_tt_git_dir_branches_tt">Named file in <tt>$GIT_DIR/branches</tt></h3><div style="clear:left"></div>
941 <div class="paragraph"><p>You can choose to provide the name of a
942 file in <tt>$GIT_DIR/branches</tt>.
943 The URL in this file will be used to access the repository.
944 This file should have the following format:</p></div>
945 <div class="listingblock">
946 <div class="content">
947 <pre><tt> &lt;url&gt;#&lt;head&gt;</tt></pre>
948 </div></div>
949 <div class="paragraph"><p><tt>&lt;url&gt;</tt> is required; <tt>#&lt;head&gt;</tt> is optional.</p></div>
950 <div class="paragraph"><p>Depending on the operation, git will use one of the following
951 refspecs, if you don&#8217;t provide one on the command line.
952 <tt>&lt;branch&gt;</tt> is the name of this file in <tt>$GIT_DIR/branches</tt> and
953 <tt>&lt;head&gt;</tt> defaults to <tt>master</tt>.</p></div>
954 <div class="paragraph"><p>git fetch uses:</p></div>
955 <div class="listingblock">
956 <div class="content">
957 <pre><tt> refs/heads/&lt;head&gt;:refs/heads/&lt;branch&gt;</tt></pre>
958 </div></div>
959 <div class="paragraph"><p>git push uses:</p></div>
960 <div class="listingblock">
961 <div class="content">
962 <pre><tt> HEAD:refs/heads/&lt;head&gt;</tt></pre>
963 </div></div>
964 </div>
965 <h2 id="_examples">EXAMPLES</h2>
966 <div class="sectionbody">
967 <div class="ulist"><ul>
968 <li>
970 Update the remote-tracking branches:
971 </p>
972 <div class="listingblock">
973 <div class="content">
974 <pre><tt>$ git fetch origin</tt></pre>
975 </div></div>
976 <div class="paragraph"><p>The above command copies all branches from the remote refs/heads/
977 namespace and stores them to the local refs/remotes/origin/ namespace,
978 unless the branch.&lt;name&gt;.fetch option is used to specify a non-default
979 refspec.</p></div>
980 </li>
981 <li>
983 Using refspecs explicitly:
984 </p>
985 <div class="listingblock">
986 <div class="content">
987 <pre><tt>$ git fetch origin +pu:pu maint:tmp</tt></pre>
988 </div></div>
989 <div class="paragraph"><p>This updates (or creates, as necessary) branches <tt>pu</tt> and <tt>tmp</tt> in
990 the local repository by fetching from the branches (respectively)
991 <tt>pu</tt> and <tt>maint</tt> from the remote repository.</p></div>
992 <div class="paragraph"><p>The <tt>pu</tt> branch will be updated even if it is does not fast-forward,
993 because it is prefixed with a plus sign; <tt>tmp</tt> will not be.</p></div>
994 </li>
995 </ul></div>
996 </div>
997 <h2 id="_see_also">SEE ALSO</h2>
998 <div class="sectionbody">
999 <div class="paragraph"><p><a href="git-pull.html">git-pull(1)</a></p></div>
1000 </div>
1001 <h2 id="_author">Author</h2>
1002 <div class="sectionbody">
1003 <div class="paragraph"><p>Written by Linus Torvalds &lt;<a href="mailto:torvalds@osdl.org">torvalds@osdl.org</a>&gt; and
1004 Junio C Hamano &lt;<a href="mailto:gitster@pobox.com">gitster@pobox.com</a>&gt;</p></div>
1005 </div>
1006 <h2 id="_documentation">Documentation</h2>
1007 <div class="sectionbody">
1008 <div class="paragraph"><p>Documentation by David Greaves, Junio C Hamano and the git-list &lt;<a href="mailto:git@vger.kernel.org">git@vger.kernel.org</a>&gt;.</p></div>
1009 </div>
1010 <h2 id="_git">GIT</h2>
1011 <div class="sectionbody">
1012 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1013 </div>
1014 <div id="footer">
1015 <div id="footer-text">
1016 Last updated 2010-11-25 03:13:41 UTC
1017 </div>
1018 </div>
1019 </body>
1020 </html>