Autogenerated HTML docs for v1.7.1
[git/jnareb-git.git] / git-fetch.html
blobfd16260db98344127a05a3ca3fb531b0208dd1f8
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.2.5" />
7 <style type="text/css">
8 /* Debug borders */
9 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
11 border: 1px solid red;
15 body {
16 margin: 1em 5% 1em 5%;
19 a {
20 color: blue;
21 text-decoration: underline;
23 a:visited {
24 color: fuchsia;
27 em {
28 font-style: italic;
31 strong {
32 font-weight: bold;
35 tt {
36 color: navy;
39 h1, h2, h3, h4, h5, h6 {
40 color: #527bbd;
41 font-family: sans-serif;
42 margin-top: 1.2em;
43 margin-bottom: 0.5em;
44 line-height: 1.3;
47 h1, h2, h3 {
48 border-bottom: 2px solid silver;
50 h2 {
51 padding-top: 0.5em;
53 h3 {
54 float: left;
56 h3 + * {
57 clear: left;
60 div.sectionbody {
61 font-family: serif;
62 margin-left: 0;
65 hr {
66 border: 1px solid silver;
69 p {
70 margin-top: 0.5em;
71 margin-bottom: 0.5em;
74 pre {
75 padding: 0;
76 margin: 0;
79 span#author {
80 color: #527bbd;
81 font-family: sans-serif;
82 font-weight: bold;
83 font-size: 1.1em;
85 span#email {
87 span#revision {
88 font-family: sans-serif;
91 div#footer {
92 font-family: sans-serif;
93 font-size: small;
94 border-top: 2px solid silver;
95 padding-top: 0.5em;
96 margin-top: 4.0em;
98 div#footer-text {
99 float: left;
100 padding-bottom: 0.5em;
102 div#footer-badges {
103 float: right;
104 padding-bottom: 0.5em;
107 div#preamble,
108 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
109 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
110 div.admonitionblock {
111 margin-right: 10%;
112 margin-top: 1.5em;
113 margin-bottom: 1.5em;
115 div.admonitionblock {
116 margin-top: 2.5em;
117 margin-bottom: 2.5em;
120 div.content { /* Block element content. */
121 padding: 0;
124 /* Block element titles. */
125 div.title, caption.title {
126 font-family: sans-serif;
127 font-weight: bold;
128 text-align: left;
129 margin-top: 1.0em;
130 margin-bottom: 0.5em;
132 div.title + * {
133 margin-top: 0;
136 td div.title:first-child {
137 margin-top: 0.0em;
139 div.content div.title:first-child {
140 margin-top: 0.0em;
142 div.content + div.title {
143 margin-top: 0.0em;
146 div.sidebarblock > div.content {
147 background: #ffffee;
148 border: 1px solid silver;
149 padding: 0.5em;
152 div.listingblock {
153 margin-right: 0%;
155 div.listingblock > div.content {
156 border: 1px solid silver;
157 background: #f4f4f4;
158 padding: 0.5em;
161 div.quoteblock > div.content {
162 padding-left: 2.0em;
165 div.attribution {
166 text-align: right;
168 div.verseblock + div.attribution {
169 text-align: left;
172 div.admonitionblock .icon {
173 vertical-align: top;
174 font-size: 1.1em;
175 font-weight: bold;
176 text-decoration: underline;
177 color: #527bbd;
178 padding-right: 0.5em;
180 div.admonitionblock td.content {
181 padding-left: 0.5em;
182 border-left: 2px solid silver;
185 div.exampleblock > div.content {
186 border-left: 2px solid silver;
187 padding: 0.5em;
190 div.verseblock div.content {
191 white-space: pre;
194 div.imageblock div.content { padding-left: 0; }
195 div.imageblock img { border: 1px solid silver; }
196 span.image img { border-style: none; }
198 dl {
199 margin-top: 0.8em;
200 margin-bottom: 0.8em;
202 dt {
203 margin-top: 0.5em;
204 margin-bottom: 0;
205 font-style: italic;
207 dd > *:first-child {
208 margin-top: 0;
211 ul, ol {
212 list-style-position: outside;
214 div.olist2 ol {
215 list-style-type: lower-alpha;
218 div.tableblock > table {
219 border: 3px solid #527bbd;
221 thead {
222 font-family: sans-serif;
223 font-weight: bold;
225 tfoot {
226 font-weight: bold;
229 div.hlist {
230 margin-top: 0.8em;
231 margin-bottom: 0.8em;
233 div.hlist td {
234 padding-bottom: 5px;
236 td.hlist1 {
237 vertical-align: top;
238 font-style: italic;
239 padding-right: 0.8em;
241 td.hlist2 {
242 vertical-align: top;
245 @media print {
246 div#footer-badges { display: none; }
249 div#toctitle {
250 color: #527bbd;
251 font-family: sans-serif;
252 font-size: 1.1em;
253 font-weight: bold;
254 margin-top: 1.0em;
255 margin-bottom: 0.1em;
258 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
259 margin-top: 0;
260 margin-bottom: 0;
262 div.toclevel2 {
263 margin-left: 2em;
264 font-size: 0.9em;
266 div.toclevel3 {
267 margin-left: 4em;
268 font-size: 0.9em;
270 div.toclevel4 {
271 margin-left: 6em;
272 font-size: 0.9em;
274 include1::./stylesheets/xhtml11-manpage.css[]
275 /* Workarounds for IE6's broken and incomplete CSS2. */
277 div.sidebar-content {
278 background: #ffffee;
279 border: 1px solid silver;
280 padding: 0.5em;
282 div.sidebar-title, div.image-title {
283 font-family: sans-serif;
284 font-weight: bold;
285 margin-top: 0.0em;
286 margin-bottom: 0.5em;
289 div.listingblock div.content {
290 border: 1px solid silver;
291 background: #f4f4f4;
292 padding: 0.5em;
295 div.quoteblock-content {
296 padding-left: 2.0em;
299 div.exampleblock-content {
300 border-left: 2px solid silver;
301 padding-left: 0.5em;
304 /* IE6 sets dynamically generated links as visited. */
305 div#toc a:visited { color: blue; }
306 </style>
307 <title>git-fetch(1)</title>
308 </head>
309 <body>
310 <div id="header">
311 <h1>
312 git-fetch(1) Manual Page
313 </h1>
314 <h2>NAME</h2>
315 <div class="sectionbody">
316 <p>git-fetch -
317 Download objects and refs from another repository
318 </p>
319 </div>
320 </div>
321 <h2>SYNOPSIS</h2>
322 <div class="sectionbody">
323 <div class="para"><p><em>git fetch</em> [&lt;options&gt;] [&lt;repository&gt; [&lt;refspec&gt;&#8230;]]</p></div>
324 <div class="para"><p><em>git fetch</em> [&lt;options&gt;] &lt;group&gt;</p></div>
325 <div class="para"><p><em>git fetch</em> --multiple [&lt;options&gt;] [&lt;repository&gt; | &lt;group&gt;]&#8230;</p></div>
326 <div class="para"><p><em>git fetch</em> --all [&lt;options&gt;]</p></div>
327 </div>
328 <h2 id="_description">DESCRIPTION</h2>
329 <div class="sectionbody">
330 <div class="para"><p>Fetches named heads or tags from one or more other repositories,
331 along with the objects necessary to complete them.</p></div>
332 <div class="para"><p>The ref names and their object names of fetched refs are stored
333 in <tt>.git/FETCH_HEAD</tt>. This information is left for a later merge
334 operation done by <em>git merge</em>.</p></div>
335 <div class="para"><p>When &lt;refspec&gt; stores the fetched result in tracking branches,
336 the tags that point at these branches are automatically
337 followed. This is done by first fetching from the remote using
338 the given &lt;refspec&gt;s, and if the repository has objects that are
339 pointed by remote tags that it does not yet have, then fetch
340 those missing tags. If the other end has tags that point at
341 branches you are not interested in, you will not get them.</p></div>
342 <div class="para"><p><em>git fetch</em> can fetch from either a single named repository, or
343 or from several repositories at once if &lt;group&gt; is given and
344 there is a remotes.&lt;group&gt; entry in the configuration file.
345 (See <a href="git-config.html">git-config(1)</a>).</p></div>
346 </div>
347 <h2 id="_options">OPTIONS</h2>
348 <div class="sectionbody">
349 <div class="vlist"><dl>
350 <dt>
351 --all
352 </dt>
353 <dd>
355 Fetch all remotes.
356 </p>
357 </dd>
358 <dt>
360 </dt>
361 <dt>
362 --append
363 </dt>
364 <dd>
366 Append ref names and object names of fetched refs to the
367 existing contents of <tt>.git/FETCH_HEAD</tt>. Without this
368 option old data in <tt>.git/FETCH_HEAD</tt> will be overwritten.
369 </p>
370 </dd>
371 <dt>
372 --depth=&lt;depth&gt;
373 </dt>
374 <dd>
376 Deepen the history of a <em>shallow</em> repository created by
377 <tt>git clone</tt> with <tt>--depth=&lt;depth&gt;</tt> option (see <a href="git-clone.html">git-clone(1)</a>)
378 by the specified number of commits.
379 </p>
380 </dd>
381 <dt>
382 --dry-run
383 </dt>
384 <dd>
386 Show what would be done, without making any changes.
387 </p>
388 </dd>
389 <dt>
391 </dt>
392 <dt>
393 --force
394 </dt>
395 <dd>
397 When <em>git fetch</em> is used with <tt>&lt;rbranch&gt;:&lt;lbranch&gt;</tt>
398 refspec, it refuses to update the local branch
399 <tt>&lt;lbranch&gt;</tt> unless the remote branch <tt>&lt;rbranch&gt;</tt> it
400 fetches is a descendant of <tt>&lt;lbranch&gt;</tt>. This option
401 overrides that check.
402 </p>
403 </dd>
404 <dt>
406 </dt>
407 <dt>
408 --keep
409 </dt>
410 <dd>
412 Keep downloaded pack.
413 </p>
414 </dd>
415 <dt>
416 --multiple
417 </dt>
418 <dd>
420 Allow several &lt;repository&gt; and &lt;group&gt; arguments to be
421 specified. No &lt;refspec&gt;s may be specified.
422 </p>
423 </dd>
424 <dt>
425 --prune
426 </dt>
427 <dd>
429 After fetching, remove any remote tracking branches which
430 no longer exist on the remote.
431 </p>
432 </dd>
433 <dt>
435 </dt>
436 <dt>
437 --no-tags
438 </dt>
439 <dd>
441 By default, tags that point at objects that are downloaded
442 from the remote repository are fetched and stored locally.
443 This option disables this automatic tag following.
444 </p>
445 </dd>
446 <dt>
448 </dt>
449 <dt>
450 --tags
451 </dt>
452 <dd>
454 Most of the tags are fetched automatically as branch
455 heads are downloaded, but tags that do not point at
456 objects reachable from the branch heads that are being
457 tracked will not be fetched by this mechanism. This
458 flag lets all tags and their associated objects be
459 downloaded.
460 </p>
461 </dd>
462 <dt>
464 </dt>
465 <dt>
466 --update-head-ok
467 </dt>
468 <dd>
470 By default <em>git fetch</em> refuses to update the head which
471 corresponds to the current branch. This flag disables the
472 check. This is purely for the internal use for <em>git pull</em>
473 to communicate with <em>git fetch</em>, and unless you are
474 implementing your own Porcelain you are not supposed to
475 use it.
476 </p>
477 </dd>
478 <dt>
479 --upload-pack &lt;upload-pack&gt;
480 </dt>
481 <dd>
483 When given, and the repository to fetch from is handled
484 by <em>git fetch-pack</em>, <em>--exec=&lt;upload-pack&gt;</em> is passed to
485 the command to specify non-default path for the command
486 run on the other end.
487 </p>
488 </dd>
489 <dt>
491 </dt>
492 <dt>
493 --quiet
494 </dt>
495 <dd>
497 Pass --quiet to git-fetch-pack and silence any other internally
498 used git commands. Progress is not reported to the standard error
499 stream.
500 </p>
501 </dd>
502 <dt>
504 </dt>
505 <dt>
506 --verbose
507 </dt>
508 <dd>
510 Be verbose.
511 </p>
512 </dd>
513 <dt>
514 --progress
515 </dt>
516 <dd>
518 Progress status is reported on the standard error stream
519 by default when it is attached to a terminal, unless -q
520 is specified. This flag forces progress status even if the
521 standard error stream is not directed to a terminal.
522 </p>
523 </dd>
524 <dt>
525 &lt;repository&gt;
526 </dt>
527 <dd>
529 The "remote" repository that is the source of a fetch
530 or pull operation. This parameter can be either a URL
531 (see the section <a href="#URLS">GIT URLS</a> below) or the name
532 of a remote (see the section <a href="#REMOTES">REMOTES</a> below).
533 </p>
534 </dd>
535 <dt>
536 &lt;group&gt;
537 </dt>
538 <dd>
540 A name referring to a list of repositories as the value
541 of remotes.&lt;group&gt; in the configuration file.
542 (See <a href="git-config.html">git-config(1)</a>).
543 </p>
544 </dd>
545 <dt>
546 &lt;refspec&gt;
547 </dt>
548 <dd>
550 The format of a &lt;refspec&gt; parameter is an optional plus
551 <tt>&#43;</tt>, followed by the source ref &lt;src&gt;, followed
552 by a colon <tt>:</tt>, followed by the destination ref &lt;dst&gt;.
553 </p>
554 <div class="para"><p>The remote ref that matches &lt;src&gt;
555 is fetched, and if &lt;dst&gt; is not empty string, the local
556 ref that matches it is fast-forwarded using &lt;src&gt;.
557 If the optional plus <tt>+</tt> is used, the local ref
558 is updated even if it does not result in a fast-forward
559 update.</p></div>
560 <div class="admonitionblock">
561 <table><tr>
562 <td class="icon">
563 <div class="title">Note</div>
564 </td>
565 <td class="content">If the remote branch from which you want to pull is
566 modified in non-linear ways such as being rewound and
567 rebased frequently, then a pull will attempt a merge with
568 an older version of itself, likely conflict, and fail.
569 It is under these conditions that you would want to use
570 the <tt>+</tt> sign to indicate non-fast-forward updates will
571 be needed. There is currently no easy way to determine
572 or declare that a branch will be made available in a
573 repository with this behavior; the pulling user simply
574 must know this is the expected usage pattern for a branch.</td>
575 </tr></table>
576 </div>
577 <div class="admonitionblock">
578 <table><tr>
579 <td class="icon">
580 <div class="title">Note</div>
581 </td>
582 <td class="content">You never do your own development on branches that appear
583 on the right hand side of a &lt;refspec&gt; colon on <tt>Pull:</tt> lines;
584 they are to be updated by <em>git fetch</em>. If you intend to do
585 development derived from a remote branch <tt>B</tt>, have a <tt>Pull:</tt>
586 line to track it (i.e. <tt>Pull: B:remote-B</tt>), and have a separate
587 branch <tt>my-B</tt> to do your development on top of it. The latter
588 is created by <tt>git branch my-B remote-B</tt> (or its equivalent <tt>git
589 checkout -b my-B remote-B</tt>). Run <tt>git fetch</tt> to keep track of
590 the progress of the remote side, and when you see something new
591 on the remote branch, merge it into your development branch with
592 <tt>git pull . remote-B</tt>, while you are on <tt>my-B</tt> branch.</td>
593 </tr></table>
594 </div>
595 <div class="admonitionblock">
596 <table><tr>
597 <td class="icon">
598 <div class="title">Note</div>
599 </td>
600 <td class="content">There is a difference between listing multiple &lt;refspec&gt;
601 directly on <em>git pull</em> command line and having multiple
602 <tt>Pull:</tt> &lt;refspec&gt; lines for a &lt;repository&gt; and running
603 <em>git pull</em> command without any explicit &lt;refspec&gt; parameters.
604 &lt;refspec&gt; listed explicitly on the command line are always
605 merged into the current branch after fetching. In other words,
606 if you list more than one remote refs, you would be making
607 an Octopus. While <em>git pull</em> run without any explicit &lt;refspec&gt;
608 parameter takes default &lt;refspec&gt;s from <tt>Pull:</tt> lines, it
609 merges only the first &lt;refspec&gt; found into the current branch,
610 after fetching all the remote refs. This is because making an
611 Octopus from remote refs is rarely done, while keeping track
612 of multiple remote heads in one-go by fetching more than one
613 is often useful.</td>
614 </tr></table>
615 </div>
616 <div class="para"><p>Some short-cut notations are also supported.</p></div>
617 <div class="ilist"><ul>
618 <li>
620 <tt>tag &lt;tag&gt;</tt> means the same as <tt>refs/tags/&lt;tag&gt;:refs/tags/&lt;tag&gt;</tt>;
621 it requests fetching everything up to the given tag.
622 </p>
623 </li>
624 <li>
626 A parameter &lt;ref&gt; without a colon is equivalent to
627 &lt;ref&gt;: when pulling/fetching, so it merges &lt;ref&gt; into the current
628 branch without storing the remote branch anywhere locally
629 </p>
630 </li>
631 </ul></div>
632 </dd>
633 </dl></div>
634 </div>
635 <h2 id="_git_urls_a_id_urls_a">GIT URLS<a id="URLS"></a></h2>
636 <div class="sectionbody">
637 <div class="para"><p>In general, URLs contain information about the transport protocol, the
638 address of the remote server, and the path to the repository.
639 Depending on the transport protocol, some of this information may be
640 absent.</p></div>
641 <div class="para"><p>Git natively supports ssh, git, http, https, ftp, ftps, and rsync
642 protocols. The following syntaxes may be used with them:</p></div>
643 <div class="ilist"><ul>
644 <li>
646 ssh://&#91;user@&#93;host.xz&#91;:port&#93;/path/to/repo.git/
647 </p>
648 </li>
649 <li>
651 git://host.xz&#91;:port&#93;/path/to/repo.git/
652 </p>
653 </li>
654 <li>
656 http&#91;s&#93;://host.xz&#91;:port&#93;/path/to/repo.git/
657 </p>
658 </li>
659 <li>
661 ftp&#91;s&#93;://host.xz&#91;:port&#93;/path/to/repo.git/
662 </p>
663 </li>
664 <li>
666 rsync://host.xz/path/to/repo.git/
667 </p>
668 </li>
669 </ul></div>
670 <div class="para"><p>An alternative scp-like syntax may also be used with the ssh protocol:</p></div>
671 <div class="ilist"><ul>
672 <li>
674 &#91;user@&#93;host.xz:path/to/repo.git/
675 </p>
676 </li>
677 </ul></div>
678 <div class="para"><p>The ssh and git protocols additionally support ~username expansion:</p></div>
679 <div class="ilist"><ul>
680 <li>
682 ssh://&#91;user@&#93;host.xz&#91;:port&#93;/~&#91;user&#93;/path/to/repo.git/
683 </p>
684 </li>
685 <li>
687 git://host.xz&#91;:port&#93;/~&#91;user&#93;/path/to/repo.git/
688 </p>
689 </li>
690 <li>
692 &#91;user@&#93;host.xz:/~&#91;user&#93;/path/to/repo.git/
693 </p>
694 </li>
695 </ul></div>
696 <div class="para"><p>For local respositories, also supported by git natively, the following
697 syntaxes may be used:</p></div>
698 <div class="ilist"><ul>
699 <li>
701 /path/to/repo.git/
702 </p>
703 </li>
704 <li>
706 file:///path/to/repo.git/
707 </p>
708 </li>
709 </ul></div>
710 <div class="para"><p>These two syntaxes are mostly equivalent, except when cloning, when
711 the former implies --local option. See <a href="git-clone.html">git-clone(1)</a> for
712 details.</p></div>
713 <div class="para"><p>When git doesn't know how to handle a certain transport protocol, it
714 attempts to use the <em>remote-&lt;transport&gt;</em> remote helper, if one
715 exists. To explicitly request a remote helper, the following syntax
716 may be used:</p></div>
717 <div class="ilist"><ul>
718 <li>
720 &lt;transport&gt;::&lt;address&gt;
721 </p>
722 </li>
723 </ul></div>
724 <div class="para"><p>where &lt;address&gt; may be a path, a server and path, or an arbitrary
725 URL-like string recognized by the specific remote helper being
726 invoked. See <a href="git-remote-helpers.html">git-remote-helpers(1)</a> for details.</p></div>
727 <div class="para"><p>If there are a large number of similarly-named remote repositories and
728 you want to use a different format for them (such that the URLs you
729 use will be rewritten into URLs that work), you can create a
730 configuration section of the form:</p></div>
731 <div class="listingblock">
732 <div class="content">
733 <pre><tt> [url "&lt;actual url base&gt;"]
734 insteadOf = &lt;other url base&gt;</tt></pre>
735 </div></div>
736 <div class="para"><p>For example, with this:</p></div>
737 <div class="listingblock">
738 <div class="content">
739 <pre><tt> [url "git://git.host.xz/"]
740 insteadOf = host.xz:/path/to/
741 insteadOf = work:</tt></pre>
742 </div></div>
743 <div class="para"><p>a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be
744 rewritten in any context that takes a URL to be "git://git.host.xz/repo.git".</p></div>
745 <div class="para"><p>If you want to rewrite URLs for push only, you can create a
746 configuration section of the form:</p></div>
747 <div class="listingblock">
748 <div class="content">
749 <pre><tt> [url "&lt;actual url base&gt;"]
750 pushInsteadOf = &lt;other url base&gt;</tt></pre>
751 </div></div>
752 <div class="para"><p>For example, with this:</p></div>
753 <div class="listingblock">
754 <div class="content">
755 <pre><tt> [url "ssh://example.org/"]
756 pushInsteadOf = git://example.org/</tt></pre>
757 </div></div>
758 <div class="para"><p>a URL like "git://example.org/path/to/repo.git" will be rewritten to
759 "ssh://example.org/path/to/repo.git" for pushes, but pulls will still
760 use the original URL.</p></div>
761 </div>
762 <h2 id="_remotes_a_id_remotes_a">REMOTES<a id="REMOTES"></a></h2>
763 <div class="sectionbody">
764 <div class="para"><p>The name of one of the following can be used instead
765 of a URL as <tt>&lt;repository&gt;</tt> argument:</p></div>
766 <div class="ilist"><ul>
767 <li>
769 a remote in the git configuration file: <tt>$GIT_DIR/config</tt>,
770 </p>
771 </li>
772 <li>
774 a file in the <tt>$GIT_DIR/remotes</tt> directory, or
775 </p>
776 </li>
777 <li>
779 a file in the <tt>$GIT_DIR/branches</tt> directory.
780 </p>
781 </li>
782 </ul></div>
783 <div class="para"><p>All of these also allow you to omit the refspec from the command line
784 because they each contain a refspec which git will use by default.</p></div>
785 <h3 id="_named_remote_in_configuration_file">Named remote in configuration file</h3><div style="clear:left"></div>
786 <div class="para"><p>You can choose to provide the name of a remote which you had previously
787 configured using <a href="git-remote.html">git-remote(1)</a>, <a href="git-config.html">git-config(1)</a>
788 or even by a manual edit to the <tt>$GIT_DIR/config</tt> file. The URL of
789 this remote will be used to access the repository. The refspec
790 of this remote will be used by default when you do
791 not provide a refspec on the command line. The entry in the
792 config file would appear like this:</p></div>
793 <div class="listingblock">
794 <div class="content">
795 <pre><tt> [remote "&lt;name&gt;"]
796 url = &lt;url&gt;
797 pushurl = &lt;pushurl&gt;
798 push = &lt;refspec&gt;
799 fetch = &lt;refspec&gt;</tt></pre>
800 </div></div>
801 <div class="para"><p>The <tt>&lt;pushurl&gt;</tt> is used for pushes only. It is optional and defaults
802 to <tt>&lt;url&gt;</tt>.</p></div>
803 <h3 id="_named_file_in_tt_git_dir_remotes_tt">Named file in <tt>$GIT_DIR/remotes</tt></h3><div style="clear:left"></div>
804 <div class="para"><p>You can choose to provide the name of a
805 file in <tt>$GIT_DIR/remotes</tt>. The URL
806 in this file will be used to access the repository. The refspec
807 in this file will be used as default when you do not
808 provide a refspec on the command line. This file should have the
809 following format:</p></div>
810 <div class="listingblock">
811 <div class="content">
812 <pre><tt> URL: one of the above URL format
813 Push: &lt;refspec&gt;
814 Pull: &lt;refspec&gt;
815 </tt></pre>
816 </div></div>
817 <div class="para"><p><tt>Push:</tt> lines are used by <em>git push</em> and
818 <tt>Pull:</tt> lines are used by <em>git pull</em> and <em>git fetch</em>.
819 Multiple <tt>Push:</tt> and <tt>Pull:</tt> lines may
820 be specified for additional branch mappings.</p></div>
821 <h3 id="_named_file_in_tt_git_dir_branches_tt">Named file in <tt>$GIT_DIR/branches</tt></h3><div style="clear:left"></div>
822 <div class="para"><p>You can choose to provide the name of a
823 file in <tt>$GIT_DIR/branches</tt>.
824 The URL in this file will be used to access the repository.
825 This file should have the following format:</p></div>
826 <div class="listingblock">
827 <div class="content">
828 <pre><tt> &lt;url&gt;#&lt;head&gt;</tt></pre>
829 </div></div>
830 <div class="para"><p><tt>&lt;url&gt;</tt> is required; <tt>#&lt;head&gt;</tt> is optional.</p></div>
831 <div class="para"><p>Depending on the operation, git will use one of the following
832 refspecs, if you don't provide one on the command line.
833 <tt>&lt;branch&gt;</tt> is the name of this file in <tt>$GIT_DIR/branches</tt> and
834 <tt>&lt;head&gt;</tt> defaults to <tt>master</tt>.</p></div>
835 <div class="para"><p>git fetch uses:</p></div>
836 <div class="listingblock">
837 <div class="content">
838 <pre><tt> refs/heads/&lt;head&gt;:refs/heads/&lt;branch&gt;</tt></pre>
839 </div></div>
840 <div class="para"><p>git push uses:</p></div>
841 <div class="listingblock">
842 <div class="content">
843 <pre><tt> HEAD:refs/heads/&lt;head&gt;</tt></pre>
844 </div></div>
845 </div>
846 <h2 id="_examples">EXAMPLES</h2>
847 <div class="sectionbody">
848 <div class="ilist"><ul>
849 <li>
851 Update the remote-tracking branches:
852 </p>
853 <div class="listingblock">
854 <div class="content">
855 <pre><tt>$ git fetch origin</tt></pre>
856 </div></div>
857 <div class="para"><p>The above command copies all branches from the remote refs/heads/
858 namespace and stores them to the local refs/remotes/origin/ namespace,
859 unless the branch.&lt;name&gt;.fetch option is used to specify a non-default
860 refspec.</p></div>
861 </li>
862 <li>
864 Using refspecs explicitly:
865 </p>
866 <div class="listingblock">
867 <div class="content">
868 <pre><tt>$ git fetch origin +pu:pu maint:tmp</tt></pre>
869 </div></div>
870 <div class="para"><p>This updates (or creates, as necessary) branches <tt>pu</tt> and <tt>tmp</tt> in
871 the local repository by fetching from the branches (respectively)
872 <tt>pu</tt> and <tt>maint</tt> from the remote repository.</p></div>
873 <div class="para"><p>The <tt>pu</tt> branch will be updated even if it is does not fast-forward,
874 because it is prefixed with a plus sign; <tt>tmp</tt> will not be.</p></div>
875 </li>
876 </ul></div>
877 </div>
878 <h2 id="_see_also">SEE ALSO</h2>
879 <div class="sectionbody">
880 <div class="para"><p><a href="git-pull.html">git-pull(1)</a></p></div>
881 </div>
882 <h2 id="_author">Author</h2>
883 <div class="sectionbody">
884 <div class="para"><p>Written by Linus Torvalds &lt;torvalds@osdl.org&gt; and
885 Junio C Hamano &lt;gitster@pobox.com&gt;</p></div>
886 </div>
887 <h2 id="_documentation">Documentation</h2>
888 <div class="sectionbody">
889 <div class="para"><p>Documentation by David Greaves, Junio C Hamano and the git-list &lt;git@vger.kernel.org&gt;.</p></div>
890 </div>
891 <h2 id="_git">GIT</h2>
892 <div class="sectionbody">
893 <div class="para"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
894 </div>
895 <div id="footer">
896 <div id="footer-text">
897 Last updated 2010-04-24 02:55:54 UTC
898 </div>
899 </div>
900 </body>
901 </html>