Autogenerated HTML docs for v1.6.3.2-202-g26c11
[git/jnareb-git.git] / git-fetch.html
blob0fbf395d055203a8b12d14c7d51dac061cfb8710
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>
325 <h2 id="_description">DESCRIPTION</h2>
326 <div class="sectionbody">
327 <div class="para"><p>Fetches named heads or tags from another repository, along with
328 the objects necessary to complete them.</p></div>
329 <div class="para"><p>The ref names and their object names of fetched refs are stored
330 in <tt>.git/FETCH_HEAD</tt>. This information is left for a later merge
331 operation done by <em>git-merge</em>.</p></div>
332 <div class="para"><p>When &lt;refspec&gt; stores the fetched result in tracking branches,
333 the tags that point at these branches are automatically
334 followed. This is done by first fetching from the remote using
335 the given &lt;refspec&gt;s, and if the repository has objects that are
336 pointed by remote tags that it does not yet have, then fetch
337 those missing tags. If the other end has tags that point at
338 branches you are not interested in, you will not get them.</p></div>
339 </div>
340 <h2 id="_options">OPTIONS</h2>
341 <div class="sectionbody">
342 <div class="vlist"><dl>
343 <dt>
345 </dt>
346 <dt>
347 --quiet
348 </dt>
349 <dd>
351 Pass --quiet to git-fetch-pack and silence any other internally
352 used programs.
353 </p>
354 </dd>
355 <dt>
357 </dt>
358 <dt>
359 --verbose
360 </dt>
361 <dd>
363 Be verbose.
364 </p>
365 </dd>
366 <dt>
368 </dt>
369 <dt>
370 --append
371 </dt>
372 <dd>
374 Append ref names and object names of fetched refs to the
375 existing contents of <tt>.git/FETCH_HEAD</tt>. Without this
376 option old data in <tt>.git/FETCH_HEAD</tt> will be overwritten.
377 </p>
378 </dd>
379 <dt>
380 --upload-pack &lt;upload-pack&gt;
381 </dt>
382 <dd>
384 When given, and the repository to fetch from is handled
385 by <em>git-fetch-pack</em>, <em>--exec=&lt;upload-pack&gt;</em> is passed to
386 the command to specify non-default path for the command
387 run on the other end.
388 </p>
389 </dd>
390 <dt>
392 </dt>
393 <dt>
394 --force
395 </dt>
396 <dd>
398 When <em>git-fetch</em> is used with <tt>&lt;rbranch&gt;:&lt;lbranch&gt;</tt>
399 refspec, it refuses to update the local branch
400 <tt>&lt;lbranch&gt;</tt> unless the remote branch <tt>&lt;rbranch&gt;</tt> it
401 fetches is a descendant of <tt>&lt;lbranch&gt;</tt>. This option
402 overrides that check.
403 </p>
404 </dd>
405 <dt>
407 </dt>
408 <dt>
409 --no-tags
410 </dt>
411 <dd>
413 By default, tags that point at objects that are downloaded
414 from the remote repository are fetched and stored locally.
415 This option disables this automatic tag following.
416 </p>
417 </dd>
418 <dt>
420 </dt>
421 <dt>
422 --tags
423 </dt>
424 <dd>
426 Most of the tags are fetched automatically as branch
427 heads are downloaded, but tags that do not point at
428 objects reachable from the branch heads that are being
429 tracked will not be fetched by this mechanism. This
430 flag lets all tags and their associated objects be
431 downloaded.
432 </p>
433 </dd>
434 <dt>
436 </dt>
437 <dt>
438 --keep
439 </dt>
440 <dd>
442 Keep downloaded pack.
443 </p>
444 </dd>
445 <dt>
447 </dt>
448 <dt>
449 --update-head-ok
450 </dt>
451 <dd>
453 By default <em>git-fetch</em> refuses to update the head which
454 corresponds to the current branch. This flag disables the
455 check. This is purely for the internal use for <em>git-pull</em>
456 to communicate with <em>git-fetch</em>, and unless you are
457 implementing your own Porcelain you are not supposed to
458 use it.
459 </p>
460 </dd>
461 <dt>
462 --depth=&lt;depth&gt;
463 </dt>
464 <dd>
466 Deepen the history of a <em>shallow</em> repository created by
467 <tt>git clone</tt> with <tt>--depth=&lt;depth&gt;</tt> option (see <a href="git-clone.html">git-clone(1)</a>)
468 by the specified number of commits.
469 </p>
470 </dd>
471 <dt>
472 &lt;repository&gt;
473 </dt>
474 <dd>
476 The "remote" repository that is the source of a fetch
477 or pull operation. This parameter can be either a URL
478 (see the section <a href="#URLS">GIT URLS</a> below) or the name
479 of a remote (see the section <a href="#REMOTES">REMOTES</a> below).
480 </p>
481 </dd>
482 <dt>
483 &lt;refspec&gt;
484 </dt>
485 <dd>
487 The format of a &lt;refspec&gt; parameter is an optional plus
488 <tt>&#43;</tt>, followed by the source ref &lt;src&gt;, followed
489 by a colon <tt>:</tt>, followed by the destination ref &lt;dst&gt;.
490 </p>
491 <div class="para"><p>The remote ref that matches &lt;src&gt;
492 is fetched, and if &lt;dst&gt; is not empty string, the local
493 ref that matches it is fast forwarded using &lt;src&gt;.
494 If the optional plus <tt>+</tt> is used, the local ref
495 is updated even if it does not result in a fast forward
496 update.</p></div>
497 <div class="admonitionblock">
498 <table><tr>
499 <td class="icon">
500 <div class="title">Note</div>
501 </td>
502 <td class="content">If the remote branch from which you want to pull is
503 modified in non-linear ways such as being rewound and
504 rebased frequently, then a pull will attempt a merge with
505 an older version of itself, likely conflict, and fail.
506 It is under these conditions that you would want to use
507 the <tt>+</tt> sign to indicate non-fast-forward updates will
508 be needed. There is currently no easy way to determine
509 or declare that a branch will be made available in a
510 repository with this behavior; the pulling user simply
511 must know this is the expected usage pattern for a branch.</td>
512 </tr></table>
513 </div>
514 <div class="admonitionblock">
515 <table><tr>
516 <td class="icon">
517 <div class="title">Note</div>
518 </td>
519 <td class="content">You never do your own development on branches that appear
520 on the right hand side of a &lt;refspec&gt; colon on <tt>Pull:</tt> lines;
521 they are to be updated by <em>git-fetch</em>. If you intend to do
522 development derived from a remote branch <tt>B</tt>, have a <tt>Pull:</tt>
523 line to track it (i.e. <tt>Pull: B:remote-B</tt>), and have a separate
524 branch <tt>my-B</tt> to do your development on top of it. The latter
525 is created by <tt>git branch my-B remote-B</tt> (or its equivalent <tt>git
526 checkout -b my-B remote-B</tt>). Run <tt>git fetch</tt> to keep track of
527 the progress of the remote side, and when you see something new
528 on the remote branch, merge it into your development branch with
529 <tt>git pull . remote-B</tt>, while you are on <tt>my-B</tt> branch.</td>
530 </tr></table>
531 </div>
532 <div class="admonitionblock">
533 <table><tr>
534 <td class="icon">
535 <div class="title">Note</div>
536 </td>
537 <td class="content">There is a difference between listing multiple &lt;refspec&gt;
538 directly on <em>git-pull</em> command line and having multiple
539 <tt>Pull:</tt> &lt;refspec&gt; lines for a &lt;repository&gt; and running
540 <em>git-pull</em> command without any explicit &lt;refspec&gt; parameters.
541 &lt;refspec&gt; listed explicitly on the command line are always
542 merged into the current branch after fetching. In other words,
543 if you list more than one remote refs, you would be making
544 an Octopus. While <em>git-pull</em> run without any explicit &lt;refspec&gt;
545 parameter takes default &lt;refspec&gt;s from <tt>Pull:</tt> lines, it
546 merges only the first &lt;refspec&gt; found into the current branch,
547 after fetching all the remote refs. This is because making an
548 Octopus from remote refs is rarely done, while keeping track
549 of multiple remote heads in one-go by fetching more than one
550 is often useful.</td>
551 </tr></table>
552 </div>
553 <div class="para"><p>Some short-cut notations are also supported.</p></div>
554 <div class="ilist"><ul>
555 <li>
557 <tt>tag &lt;tag&gt;</tt> means the same as <tt>refs/tags/&lt;tag&gt;:refs/tags/&lt;tag&gt;</tt>;
558 it requests fetching everything up to the given tag.
559 </p>
560 </li>
561 <li>
563 A parameter &lt;ref&gt; without a colon is equivalent to
564 &lt;ref&gt;: when pulling/fetching, so it merges &lt;ref&gt; into the current
565 branch without storing the remote branch anywhere locally
566 </p>
567 </li>
568 </ul></div>
569 </dd>
570 </dl></div>
571 </div>
572 <h2 id="_git_urls_a_id_urls_a">GIT URLS<a id="URLS"></a></h2>
573 <div class="sectionbody">
574 <div class="para"><p>One of the following notations can be used
575 to name the remote repository:</p></div>
576 <div class="exampleblock">
577 <div class="exampleblock-content">
578 <div class="ilist"><ul>
579 <li>
581 rsync://host.xz/path/to/repo.git/
582 </p>
583 </li>
584 <li>
586 http://host.xz&#91;:port&#93;/path/to/repo.git/
587 </p>
588 </li>
589 <li>
591 https://host.xz&#91;:port&#93;/path/to/repo.git/
592 </p>
593 </li>
594 <li>
596 git://host.xz&#91;:port&#93;/path/to/repo.git/
597 </p>
598 </li>
599 <li>
601 git://host.xz&#91;:port&#93;/~user/path/to/repo.git/
602 </p>
603 </li>
604 <li>
606 ssh://&#91;user@&#93;host.xz&#91;:port&#93;/path/to/repo.git/
607 </p>
608 </li>
609 <li>
611 ssh://&#91;user@&#93;host.xz/path/to/repo.git/
612 </p>
613 </li>
614 <li>
616 ssh://&#91;user@&#93;host.xz/~user/path/to/repo.git/
617 </p>
618 </li>
619 <li>
621 ssh://&#91;user@&#93;host.xz/~/path/to/repo.git
622 </p>
623 </li>
624 </ul></div>
625 </div></div>
626 <div class="para"><p>SSH is the default transport protocol over the network. You can
627 optionally specify which user to log-in as, and an alternate,
628 scp-like syntax is also supported. Both syntaxes support
629 username expansion, as does the native git protocol, but
630 only the former supports port specification. The following
631 three are identical to the last three above, respectively:</p></div>
632 <div class="exampleblock">
633 <div class="exampleblock-content">
634 <div class="ilist"><ul>
635 <li>
637 &#91;user@&#93;host.xz:/path/to/repo.git/
638 </p>
639 </li>
640 <li>
642 &#91;user@&#93;host.xz:~user/path/to/repo.git/
643 </p>
644 </li>
645 <li>
647 &#91;user@&#93;host.xz:path/to/repo.git
648 </p>
649 </li>
650 </ul></div>
651 </div></div>
652 <div class="para"><p>To sync with a local directory, you can use:</p></div>
653 <div class="exampleblock">
654 <div class="exampleblock-content">
655 <div class="ilist"><ul>
656 <li>
658 /path/to/repo.git/
659 </p>
660 </li>
661 <li>
663 file:///path/to/repo.git/
664 </p>
665 </li>
666 </ul></div>
667 </div></div>
668 <div class="para"><p>They are mostly equivalent, except when cloning. See
669 <a href="git-clone.html">git-clone(1)</a> for details.</p></div>
670 <div class="para"><p>If there are a large number of similarly-named remote repositories and
671 you want to use a different format for them (such that the URLs you
672 use will be rewritten into URLs that work), you can create a
673 configuration section of the form:</p></div>
674 <div class="listingblock">
675 <div class="content">
676 <pre><tt> [url "&lt;actual url base&gt;"]
677 insteadOf = &lt;other url base&gt;</tt></pre>
678 </div></div>
679 <div class="para"><p>For example, with this:</p></div>
680 <div class="listingblock">
681 <div class="content">
682 <pre><tt> [url "git://git.host.xz/"]
683 insteadOf = host.xz:/path/to/
684 insteadOf = work:</tt></pre>
685 </div></div>
686 <div class="para"><p>a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be
687 rewritten in any context that takes a URL to be "git://git.host.xz/repo.git".</p></div>
688 </div>
689 <h2 id="_remotes_a_id_remotes_a">REMOTES<a id="REMOTES"></a></h2>
690 <div class="sectionbody">
691 <div class="para"><p>The name of one of the following can be used instead
692 of a URL as <tt>&lt;repository&gt;</tt> argument:</p></div>
693 <div class="ilist"><ul>
694 <li>
696 a remote in the git configuration file: <tt>$GIT_DIR/config</tt>,
697 </p>
698 </li>
699 <li>
701 a file in the <tt>$GIT_DIR/remotes</tt> directory, or
702 </p>
703 </li>
704 <li>
706 a file in the <tt>$GIT_DIR/branches</tt> directory.
707 </p>
708 </li>
709 </ul></div>
710 <div class="para"><p>All of these also allow you to omit the refspec from the command line
711 because they each contain a refspec which git will use by default.</p></div>
712 <h3 id="_named_remote_in_configuration_file">Named remote in configuration file</h3><div style="clear:left"></div>
713 <div class="para"><p>You can choose to provide the name of a remote which you had previously
714 configured using <a href="git-remote.html">git-remote(1)</a>, <a href="git-config.html">git-config(1)</a>
715 or even by a manual edit to the <tt>$GIT_DIR/config</tt> file. The URL of
716 this remote will be used to access the repository. The refspec
717 of this remote will be used by default when you do
718 not provide a refspec on the command line. The entry in the
719 config file would appear like this:</p></div>
720 <div class="listingblock">
721 <div class="content">
722 <pre><tt> [remote "&lt;name&gt;"]
723 url = &lt;url&gt;
724 push = &lt;refspec&gt;
725 fetch = &lt;refspec&gt;</tt></pre>
726 </div></div>
727 <h3 id="_named_file_in_tt_git_dir_remotes_tt">Named file in <tt>$GIT_DIR/remotes</tt></h3><div style="clear:left"></div>
728 <div class="para"><p>You can choose to provide the name of a
729 file in <tt>$GIT_DIR/remotes</tt>. The URL
730 in this file will be used to access the repository. The refspec
731 in this file will be used as default when you do not
732 provide a refspec on the command line. This file should have the
733 following format:</p></div>
734 <div class="listingblock">
735 <div class="content">
736 <pre><tt> URL: one of the above URL format
737 Push: &lt;refspec&gt;
738 Pull: &lt;refspec&gt;
739 </tt></pre>
740 </div></div>
741 <div class="para"><p><tt>Push:</tt> lines are used by <em>git-push</em> and
742 <tt>Pull:</tt> lines are used by <em>git-pull</em> and <em>git-fetch</em>.
743 Multiple <tt>Push:</tt> and <tt>Pull:</tt> lines may
744 be specified for additional branch mappings.</p></div>
745 <h3 id="_named_file_in_tt_git_dir_branches_tt">Named file in <tt>$GIT_DIR/branches</tt></h3><div style="clear:left"></div>
746 <div class="para"><p>You can choose to provide the name of a
747 file in <tt>$GIT_DIR/branches</tt>.
748 The URL in this file will be used to access the repository.
749 This file should have the following format:</p></div>
750 <div class="listingblock">
751 <div class="content">
752 <pre><tt> &lt;url&gt;#&lt;head&gt;</tt></pre>
753 </div></div>
754 <div class="para"><p><tt>&lt;url&gt;</tt> is required; <tt>#&lt;head&gt;</tt> is optional.</p></div>
755 <div class="para"><p>Depending on the operation, git will use one of the following
756 refspecs, if you don't provide one on the command line.
757 <tt>&lt;branch&gt;</tt> is the name of this file in <tt>$GIT_DIR/branches</tt> and
758 <tt>&lt;head&gt;</tt> defaults to <tt>master</tt>.</p></div>
759 <div class="para"><p>git fetch uses:</p></div>
760 <div class="listingblock">
761 <div class="content">
762 <pre><tt> refs/heads/&lt;head&gt;:refs/heads/&lt;branch&gt;</tt></pre>
763 </div></div>
764 <div class="para"><p>git push uses:</p></div>
765 <div class="listingblock">
766 <div class="content">
767 <pre><tt> HEAD:refs/heads/&lt;head&gt;</tt></pre>
768 </div></div>
769 </div>
770 <h2 id="_see_also">SEE ALSO</h2>
771 <div class="sectionbody">
772 <div class="para"><p><a href="git-pull.html">git-pull(1)</a></p></div>
773 </div>
774 <h2 id="_author">Author</h2>
775 <div class="sectionbody">
776 <div class="para"><p>Written by Linus Torvalds &lt;torvalds@osdl.org&gt; and
777 Junio C Hamano &lt;gitster@pobox.com&gt;</p></div>
778 </div>
779 <h2 id="_documentation">Documentation</h2>
780 <div class="sectionbody">
781 <div class="para"><p>Documentation by David Greaves, Junio C Hamano and the git-list &lt;git@vger.kernel.org&gt;.</p></div>
782 </div>
783 <h2 id="_git">GIT</h2>
784 <div class="sectionbody">
785 <div class="para"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
786 </div>
787 <div id="footer">
788 <div id="footer-text">
789 Last updated 2009-04-02 06:49:52 UTC
790 </div>
791 </div>
792 </body>
793 </html>