Autogenerated HTML docs for v1.6.4-rc1
[git/jnareb-git.git] / git-pull.html
blob9ca57a4a7af55a079e685f06c3c8dd3cf1905eb3
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-pull(1)</title>
308 </head>
309 <body>
310 <div id="header">
311 <h1>
312 git-pull(1) Manual Page
313 </h1>
314 <h2>NAME</h2>
315 <div class="sectionbody">
316 <p>git-pull -
317 Fetch from and merge with another repository or a local branch
318 </p>
319 </div>
320 </div>
321 <h2>SYNOPSIS</h2>
322 <div class="sectionbody">
323 <div class="para"><p><em>git pull</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>Runs <em>git-fetch</em> with the given parameters, and calls <em>git-merge</em>
328 to merge the retrieved head(s) into the current branch.
329 With <tt>--rebase</tt>, calls <em>git-rebase</em> instead of <em>git-merge</em>.</p></div>
330 <div class="para"><p>Note that you can use <tt>.</tt> (current directory) as the
331 &lt;repository&gt; to pull from the local repository &#8212; this is useful
332 when merging local branches into the current branch.</p></div>
333 <div class="para"><p>Also note that options meant for <em>git-pull</em> itself and underlying
334 <em>git-merge</em> must be given before the options meant for <em>git-fetch</em>.</p></div>
335 </div>
336 <h2 id="_options">OPTIONS</h2>
337 <div class="sectionbody">
338 <div class="vlist"><dl>
339 <dt>
341 </dt>
342 <dt>
343 --quiet
344 </dt>
345 <dd>
347 Operate quietly.
348 </p>
349 </dd>
350 <dt>
352 </dt>
353 <dt>
354 --verbose
355 </dt>
356 <dd>
358 Be verbose.
359 </p>
360 </dd>
361 <dt>
362 --stat
363 </dt>
364 <dd>
366 Show a diffstat at the end of the merge. The diffstat is also
367 controlled by the configuration option merge.stat.
368 </p>
369 </dd>
370 <dt>
372 </dt>
373 <dt>
374 --no-stat
375 </dt>
376 <dd>
378 Do not show a diffstat at the end of the merge.
379 </p>
380 </dd>
381 <dt>
382 --summary
383 </dt>
384 <dt>
385 --no-summary
386 </dt>
387 <dd>
389 Synonyms to --stat and --no-stat; these are deprecated and will be
390 removed in the future.
391 </p>
392 </dd>
393 <dt>
394 --log
395 </dt>
396 <dd>
398 In addition to branch names, populate the log message with
399 one-line descriptions from the actual commits that are being
400 merged.
401 </p>
402 </dd>
403 <dt>
404 --no-log
405 </dt>
406 <dd>
408 Do not list one-line descriptions from the actual commits being
409 merged.
410 </p>
411 </dd>
412 <dt>
413 --no-commit
414 </dt>
415 <dd>
417 Perform the merge but pretend the merge failed and do
418 not autocommit, to give the user a chance to inspect and
419 further tweak the merge result before committing.
420 </p>
421 </dd>
422 <dt>
423 --commit
424 </dt>
425 <dd>
427 Perform the merge and commit the result. This option can
428 be used to override --no-commit.
429 </p>
430 </dd>
431 <dt>
432 --squash
433 </dt>
434 <dd>
436 Produce the working tree and index state as if a real
437 merge happened (except for the merge information),
438 but do not actually make a commit or
439 move the <tt>HEAD</tt>, nor record <tt>$GIT_DIR/MERGE_HEAD</tt> to
440 cause the next <tt>git commit</tt> command to create a merge
441 commit. This allows you to create a single commit on
442 top of the current branch whose effect is the same as
443 merging another branch (or more in case of an octopus).
444 </p>
445 </dd>
446 <dt>
447 --no-squash
448 </dt>
449 <dd>
451 Perform the merge and commit the result. This option can
452 be used to override --squash.
453 </p>
454 </dd>
455 <dt>
456 --no-ff
457 </dt>
458 <dd>
460 Generate a merge commit even if the merge resolved as a
461 fast-forward.
462 </p>
463 </dd>
464 <dt>
465 --ff
466 </dt>
467 <dd>
469 Do not generate a merge commit if the merge resolved as
470 a fast-forward, only update the branch pointer. This is
471 the default behavior of git-merge.
472 </p>
473 </dd>
474 <dt>
475 -s &lt;strategy&gt;
476 </dt>
477 <dt>
478 --strategy=&lt;strategy&gt;
479 </dt>
480 <dd>
482 Use the given merge strategy; can be supplied more than
483 once to specify them in the order they should be tried.
484 If there is no <tt>-s</tt> option, a built-in list of strategies
485 is used instead (<em>git-merge-recursive</em> when merging a single
486 head, <em>git-merge-octopus</em> otherwise).
487 </p>
488 </dd>
489 </dl></div>
490 <div class="vlist"><dl>
491 <dt>
492 --rebase
493 </dt>
494 <dd>
496 Instead of a merge, perform a rebase after fetching. If
497 there is a remote ref for the upstream branch, and this branch
498 was rebased since last fetched, the rebase uses that information
499 to avoid rebasing non-local changes. To make this the default
500 for branch <tt>&lt;name&gt;</tt>, set configuration <tt>branch.&lt;name&gt;.rebase</tt>
501 to <tt>true</tt>.
502 </p>
503 <div class="admonitionblock">
504 <table><tr>
505 <td class="icon">
506 <div class="title">Note</div>
507 </td>
508 <td class="content">This is a potentially _dangerous_ mode of operation.
509 It rewrites history, which does not bode well when you
510 published that history already. Do <strong>not</strong> use this option
511 unless you have read <a href="git-rebase.html">git-rebase(1)</a> carefully.</td>
512 </tr></table>
513 </div>
514 </dd>
515 <dt>
516 --no-rebase
517 </dt>
518 <dd>
520 Override earlier --rebase.
521 </p>
522 </dd>
523 <dt>
525 </dt>
526 <dt>
527 --quiet
528 </dt>
529 <dd>
531 Pass --quiet to git-fetch-pack and silence any other internally
532 used programs.
533 </p>
534 </dd>
535 <dt>
537 </dt>
538 <dt>
539 --verbose
540 </dt>
541 <dd>
543 Be verbose.
544 </p>
545 </dd>
546 <dt>
548 </dt>
549 <dt>
550 --append
551 </dt>
552 <dd>
554 Append ref names and object names of fetched refs to the
555 existing contents of <tt>.git/FETCH_HEAD</tt>. Without this
556 option old data in <tt>.git/FETCH_HEAD</tt> will be overwritten.
557 </p>
558 </dd>
559 <dt>
560 --upload-pack &lt;upload-pack&gt;
561 </dt>
562 <dd>
564 When given, and the repository to fetch from is handled
565 by <em>git-fetch-pack</em>, <em>--exec=&lt;upload-pack&gt;</em> is passed to
566 the command to specify non-default path for the command
567 run on the other end.
568 </p>
569 </dd>
570 <dt>
572 </dt>
573 <dt>
574 --force
575 </dt>
576 <dd>
578 When <em>git-fetch</em> is used with <tt>&lt;rbranch&gt;:&lt;lbranch&gt;</tt>
579 refspec, it refuses to update the local branch
580 <tt>&lt;lbranch&gt;</tt> unless the remote branch <tt>&lt;rbranch&gt;</tt> it
581 fetches is a descendant of <tt>&lt;lbranch&gt;</tt>. This option
582 overrides that check.
583 </p>
584 </dd>
585 <dt>
586 --no-tags
587 </dt>
588 <dd>
590 By default, tags that point at objects that are downloaded
591 from the remote repository are fetched and stored locally.
592 This option disables this automatic tag following.
593 </p>
594 </dd>
595 <dt>
597 </dt>
598 <dt>
599 --tags
600 </dt>
601 <dd>
603 Most of the tags are fetched automatically as branch
604 heads are downloaded, but tags that do not point at
605 objects reachable from the branch heads that are being
606 tracked will not be fetched by this mechanism. This
607 flag lets all tags and their associated objects be
608 downloaded.
609 </p>
610 </dd>
611 <dt>
613 </dt>
614 <dt>
615 --keep
616 </dt>
617 <dd>
619 Keep downloaded pack.
620 </p>
621 </dd>
622 <dt>
624 </dt>
625 <dt>
626 --update-head-ok
627 </dt>
628 <dd>
630 By default <em>git-fetch</em> refuses to update the head which
631 corresponds to the current branch. This flag disables the
632 check. This is purely for the internal use for <em>git-pull</em>
633 to communicate with <em>git-fetch</em>, and unless you are
634 implementing your own Porcelain you are not supposed to
635 use it.
636 </p>
637 </dd>
638 <dt>
639 --depth=&lt;depth&gt;
640 </dt>
641 <dd>
643 Deepen the history of a <em>shallow</em> repository created by
644 <tt>git clone</tt> with <tt>--depth=&lt;depth&gt;</tt> option (see <a href="git-clone.html">git-clone(1)</a>)
645 by the specified number of commits.
646 </p>
647 </dd>
648 <dt>
649 &lt;repository&gt;
650 </dt>
651 <dd>
653 The "remote" repository that is the source of a fetch
654 or pull operation. This parameter can be either a URL
655 (see the section <a href="#URLS">GIT URLS</a> below) or the name
656 of a remote (see the section <a href="#REMOTES">REMOTES</a> below).
657 </p>
658 </dd>
659 <dt>
660 &lt;refspec&gt;
661 </dt>
662 <dd>
664 The format of a &lt;refspec&gt; parameter is an optional plus
665 <tt>&#43;</tt>, followed by the source ref &lt;src&gt;, followed
666 by a colon <tt>:</tt>, followed by the destination ref &lt;dst&gt;.
667 </p>
668 <div class="para"><p>The remote ref that matches &lt;src&gt;
669 is fetched, and if &lt;dst&gt; is not empty string, the local
670 ref that matches it is fast forwarded using &lt;src&gt;.
671 If the optional plus <tt>+</tt> is used, the local ref
672 is updated even if it does not result in a fast forward
673 update.</p></div>
674 <div class="admonitionblock">
675 <table><tr>
676 <td class="icon">
677 <div class="title">Note</div>
678 </td>
679 <td class="content">If the remote branch from which you want to pull is
680 modified in non-linear ways such as being rewound and
681 rebased frequently, then a pull will attempt a merge with
682 an older version of itself, likely conflict, and fail.
683 It is under these conditions that you would want to use
684 the <tt>+</tt> sign to indicate non-fast-forward updates will
685 be needed. There is currently no easy way to determine
686 or declare that a branch will be made available in a
687 repository with this behavior; the pulling user simply
688 must know this is the expected usage pattern for a branch.</td>
689 </tr></table>
690 </div>
691 <div class="admonitionblock">
692 <table><tr>
693 <td class="icon">
694 <div class="title">Note</div>
695 </td>
696 <td class="content">You never do your own development on branches that appear
697 on the right hand side of a &lt;refspec&gt; colon on <tt>Pull:</tt> lines;
698 they are to be updated by <em>git-fetch</em>. If you intend to do
699 development derived from a remote branch <tt>B</tt>, have a <tt>Pull:</tt>
700 line to track it (i.e. <tt>Pull: B:remote-B</tt>), and have a separate
701 branch <tt>my-B</tt> to do your development on top of it. The latter
702 is created by <tt>git branch my-B remote-B</tt> (or its equivalent <tt>git
703 checkout -b my-B remote-B</tt>). Run <tt>git fetch</tt> to keep track of
704 the progress of the remote side, and when you see something new
705 on the remote branch, merge it into your development branch with
706 <tt>git pull . remote-B</tt>, while you are on <tt>my-B</tt> branch.</td>
707 </tr></table>
708 </div>
709 <div class="admonitionblock">
710 <table><tr>
711 <td class="icon">
712 <div class="title">Note</div>
713 </td>
714 <td class="content">There is a difference between listing multiple &lt;refspec&gt;
715 directly on <em>git-pull</em> command line and having multiple
716 <tt>Pull:</tt> &lt;refspec&gt; lines for a &lt;repository&gt; and running
717 <em>git-pull</em> command without any explicit &lt;refspec&gt; parameters.
718 &lt;refspec&gt; listed explicitly on the command line are always
719 merged into the current branch after fetching. In other words,
720 if you list more than one remote refs, you would be making
721 an Octopus. While <em>git-pull</em> run without any explicit &lt;refspec&gt;
722 parameter takes default &lt;refspec&gt;s from <tt>Pull:</tt> lines, it
723 merges only the first &lt;refspec&gt; found into the current branch,
724 after fetching all the remote refs. This is because making an
725 Octopus from remote refs is rarely done, while keeping track
726 of multiple remote heads in one-go by fetching more than one
727 is often useful.</td>
728 </tr></table>
729 </div>
730 <div class="para"><p>Some short-cut notations are also supported.</p></div>
731 <div class="ilist"><ul>
732 <li>
734 <tt>tag &lt;tag&gt;</tt> means the same as <tt>refs/tags/&lt;tag&gt;:refs/tags/&lt;tag&gt;</tt>;
735 it requests fetching everything up to the given tag.
736 </p>
737 </li>
738 <li>
740 A parameter &lt;ref&gt; without a colon is equivalent to
741 &lt;ref&gt;: when pulling/fetching, so it merges &lt;ref&gt; into the current
742 branch without storing the remote branch anywhere locally
743 </p>
744 </li>
745 </ul></div>
746 </dd>
747 </dl></div>
748 </div>
749 <h2 id="_git_urls_a_id_urls_a">GIT URLS<a id="URLS"></a></h2>
750 <div class="sectionbody">
751 <div class="para"><p>One of the following notations can be used
752 to name the remote repository:</p></div>
753 <div class="exampleblock">
754 <div class="exampleblock-content">
755 <div class="ilist"><ul>
756 <li>
758 rsync://host.xz/path/to/repo.git/
759 </p>
760 </li>
761 <li>
763 http://host.xz&#91;:port&#93;/path/to/repo.git/
764 </p>
765 </li>
766 <li>
768 https://host.xz&#91;:port&#93;/path/to/repo.git/
769 </p>
770 </li>
771 <li>
773 git://host.xz&#91;:port&#93;/path/to/repo.git/
774 </p>
775 </li>
776 <li>
778 git://host.xz&#91;:port&#93;/~user/path/to/repo.git/
779 </p>
780 </li>
781 <li>
783 ssh://&#91;user@&#93;host.xz&#91;:port&#93;/path/to/repo.git/
784 </p>
785 </li>
786 <li>
788 ssh://&#91;user@&#93;host.xz/path/to/repo.git/
789 </p>
790 </li>
791 <li>
793 ssh://&#91;user@&#93;host.xz/~user/path/to/repo.git/
794 </p>
795 </li>
796 <li>
798 ssh://&#91;user@&#93;host.xz/~/path/to/repo.git
799 </p>
800 </li>
801 </ul></div>
802 </div></div>
803 <div class="para"><p>SSH is the default transport protocol over the network. You can
804 optionally specify which user to log-in as, and an alternate,
805 scp-like syntax is also supported. Both syntaxes support
806 username expansion, as does the native git protocol, but
807 only the former supports port specification. The following
808 three are identical to the last three above, respectively:</p></div>
809 <div class="exampleblock">
810 <div class="exampleblock-content">
811 <div class="ilist"><ul>
812 <li>
814 &#91;user@&#93;host.xz:/path/to/repo.git/
815 </p>
816 </li>
817 <li>
819 &#91;user@&#93;host.xz:~user/path/to/repo.git/
820 </p>
821 </li>
822 <li>
824 &#91;user@&#93;host.xz:path/to/repo.git
825 </p>
826 </li>
827 </ul></div>
828 </div></div>
829 <div class="para"><p>To sync with a local directory, you can use:</p></div>
830 <div class="exampleblock">
831 <div class="exampleblock-content">
832 <div class="ilist"><ul>
833 <li>
835 /path/to/repo.git/
836 </p>
837 </li>
838 <li>
840 file:///path/to/repo.git/
841 </p>
842 </li>
843 </ul></div>
844 </div></div>
845 <div class="para"><p>They are mostly equivalent, except when cloning. See
846 <a href="git-clone.html">git-clone(1)</a> for details.</p></div>
847 <div class="para"><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="para"><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="para"><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>
866 <h2 id="_remotes_a_id_remotes_a">REMOTES<a id="REMOTES"></a></h2>
867 <div class="sectionbody">
868 <div class="para"><p>The name of one of the following can be used instead
869 of a URL as <tt>&lt;repository&gt;</tt> argument:</p></div>
870 <div class="ilist"><ul>
871 <li>
873 a remote in the git configuration file: <tt>$GIT_DIR/config</tt>,
874 </p>
875 </li>
876 <li>
878 a file in the <tt>$GIT_DIR/remotes</tt> directory, or
879 </p>
880 </li>
881 <li>
883 a file in the <tt>$GIT_DIR/branches</tt> directory.
884 </p>
885 </li>
886 </ul></div>
887 <div class="para"><p>All of these also allow you to omit the refspec from the command line
888 because they each contain a refspec which git will use by default.</p></div>
889 <h3 id="_named_remote_in_configuration_file">Named remote in configuration file</h3><div style="clear:left"></div>
890 <div class="para"><p>You can choose to provide the name of a remote which you had previously
891 configured using <a href="git-remote.html">git-remote(1)</a>, <a href="git-config.html">git-config(1)</a>
892 or even by a manual edit to the <tt>$GIT_DIR/config</tt> file. The URL of
893 this remote will be used to access the repository. The refspec
894 of this remote will be used by default when you do
895 not provide a refspec on the command line. The entry in the
896 config file would appear like this:</p></div>
897 <div class="listingblock">
898 <div class="content">
899 <pre><tt> [remote "&lt;name&gt;"]
900 url = &lt;url&gt;
901 pushurl = &lt;pushurl&gt;
902 push = &lt;refspec&gt;
903 fetch = &lt;refspec&gt;</tt></pre>
904 </div></div>
905 <div class="para"><p>The <tt>&lt;pushurl&gt;</tt> is used for pushes only. It is optional and defaults
906 to <tt>&lt;url&gt;</tt>.</p></div>
907 <h3 id="_named_file_in_tt_git_dir_remotes_tt">Named file in <tt>$GIT_DIR/remotes</tt></h3><div style="clear:left"></div>
908 <div class="para"><p>You can choose to provide the name of a
909 file in <tt>$GIT_DIR/remotes</tt>. The URL
910 in this file will be used to access the repository. The refspec
911 in this file will be used as default when you do not
912 provide a refspec on the command line. This file should have the
913 following format:</p></div>
914 <div class="listingblock">
915 <div class="content">
916 <pre><tt> URL: one of the above URL format
917 Push: &lt;refspec&gt;
918 Pull: &lt;refspec&gt;
919 </tt></pre>
920 </div></div>
921 <div class="para"><p><tt>Push:</tt> lines are used by <em>git-push</em> and
922 <tt>Pull:</tt> lines are used by <em>git-pull</em> and <em>git-fetch</em>.
923 Multiple <tt>Push:</tt> and <tt>Pull:</tt> lines may
924 be specified for additional branch mappings.</p></div>
925 <h3 id="_named_file_in_tt_git_dir_branches_tt">Named file in <tt>$GIT_DIR/branches</tt></h3><div style="clear:left"></div>
926 <div class="para"><p>You can choose to provide the name of a
927 file in <tt>$GIT_DIR/branches</tt>.
928 The URL in this file will be used to access the repository.
929 This file should have the following format:</p></div>
930 <div class="listingblock">
931 <div class="content">
932 <pre><tt> &lt;url&gt;#&lt;head&gt;</tt></pre>
933 </div></div>
934 <div class="para"><p><tt>&lt;url&gt;</tt> is required; <tt>#&lt;head&gt;</tt> is optional.</p></div>
935 <div class="para"><p>Depending on the operation, git will use one of the following
936 refspecs, if you don't provide one on the command line.
937 <tt>&lt;branch&gt;</tt> is the name of this file in <tt>$GIT_DIR/branches</tt> and
938 <tt>&lt;head&gt;</tt> defaults to <tt>master</tt>.</p></div>
939 <div class="para"><p>git fetch uses:</p></div>
940 <div class="listingblock">
941 <div class="content">
942 <pre><tt> refs/heads/&lt;head&gt;:refs/heads/&lt;branch&gt;</tt></pre>
943 </div></div>
944 <div class="para"><p>git push uses:</p></div>
945 <div class="listingblock">
946 <div class="content">
947 <pre><tt> HEAD:refs/heads/&lt;head&gt;</tt></pre>
948 </div></div>
949 </div>
950 <h2 id="_merge_strategies">MERGE STRATEGIES</h2>
951 <div class="sectionbody">
952 <div class="vlist"><dl>
953 <dt>
954 resolve
955 </dt>
956 <dd>
958 This can only resolve two heads (i.e. the current branch
959 and another branch you pulled from) using a 3-way merge
960 algorithm. It tries to carefully detect criss-cross
961 merge ambiguities and is considered generally safe and
962 fast.
963 </p>
964 </dd>
965 <dt>
966 recursive
967 </dt>
968 <dd>
970 This can only resolve two heads using a 3-way merge
971 algorithm. When there is more than one common
972 ancestor that can be used for 3-way merge, it creates a
973 merged tree of the common ancestors and uses that as
974 the reference tree for the 3-way merge. This has been
975 reported to result in fewer merge conflicts without
976 causing mis-merges by tests done on actual merge commits
977 taken from Linux 2.6 kernel development history.
978 Additionally this can detect and handle merges involving
979 renames. This is the default merge strategy when
980 pulling or merging one branch.
981 </p>
982 </dd>
983 <dt>
984 octopus
985 </dt>
986 <dd>
988 This resolves cases with more than two heads, but refuses to do
989 a complex merge that needs manual resolution. It is
990 primarily meant to be used for bundling topic branch
991 heads together. This is the default merge strategy when
992 pulling or merging more than one branch.
993 </p>
994 </dd>
995 <dt>
996 ours
997 </dt>
998 <dd>
1000 This resolves any number of heads, but the result of the
1001 merge is always the current branch head. It is meant to
1002 be used to supersede old development history of side
1003 branches.
1004 </p>
1005 </dd>
1006 <dt>
1007 subtree
1008 </dt>
1009 <dd>
1011 This is a modified recursive strategy. When merging trees A and
1012 B, if B corresponds to a subtree of A, B is first adjusted to
1013 match the tree structure of A, instead of reading the trees at
1014 the same level. This adjustment is also done to the common
1015 ancestor tree.
1016 </p>
1017 </dd>
1018 </dl></div>
1019 </div>
1020 <h2 id="_default_behaviour">DEFAULT BEHAVIOUR</h2>
1021 <div class="sectionbody">
1022 <div class="para"><p>Often people use <tt>git pull</tt> without giving any parameter.
1023 Traditionally, this has been equivalent to saying <tt>git pull
1024 origin</tt>. However, when configuration <tt>branch.&lt;name&gt;.remote</tt> is
1025 present while on branch <tt>&lt;name&gt;</tt>, that value is used instead of
1026 <tt>origin</tt>.</p></div>
1027 <div class="para"><p>In order to determine what URL to use to fetch from, the value
1028 of the configuration <tt>remote.&lt;origin&gt;.url</tt> is consulted
1029 and if there is not any such variable, the value on <tt>URL: </tt> line
1030 in <tt>$GIT_DIR/remotes/&lt;origin&gt;</tt> file is used.</p></div>
1031 <div class="para"><p>In order to determine what remote branches to fetch (and
1032 optionally store in the tracking branches) when the command is
1033 run without any refspec parameters on the command line, values
1034 of the configuration variable <tt>remote.&lt;origin&gt;.fetch</tt> are
1035 consulted, and if there aren't any, <tt>$GIT_DIR/remotes/&lt;origin&gt;</tt>
1036 file is consulted and its <tt>Pull: </tt> lines are used.
1037 In addition to the refspec formats described in the OPTIONS
1038 section, you can have a globbing refspec that looks like this:</p></div>
1039 <div class="listingblock">
1040 <div class="content">
1041 <pre><tt>refs/heads/*:refs/remotes/origin/*</tt></pre>
1042 </div></div>
1043 <div class="para"><p>A globbing refspec must have a non-empty RHS (i.e. must store
1044 what were fetched in tracking branches), and its LHS and RHS
1045 must end with <tt>/*</tt>. The above specifies that all remote
1046 branches are tracked using tracking branches in
1047 <tt>refs/remotes/origin/</tt> hierarchy under the same name.</p></div>
1048 <div class="para"><p>The rule to determine which remote branch to merge after
1049 fetching is a bit involved, in order not to break backward
1050 compatibility.</p></div>
1051 <div class="para"><p>If explicit refspecs were given on the command
1052 line of <tt>git pull</tt>, they are all merged.</p></div>
1053 <div class="para"><p>When no refspec was given on the command line, then <tt>git pull</tt>
1054 uses the refspec from the configuration or
1055 <tt>$GIT_DIR/remotes/&lt;origin&gt;</tt>. In such cases, the following
1056 rules apply:</p></div>
1057 <div class="olist"><ol>
1058 <li>
1060 If <tt>branch.&lt;name&gt;.merge</tt> configuration for the current
1061 branch <tt>&lt;name&gt;</tt> exists, that is the name of the branch at the
1062 remote site that is merged.
1063 </p>
1064 </li>
1065 <li>
1067 If the refspec is a globbing one, nothing is merged.
1068 </p>
1069 </li>
1070 <li>
1072 Otherwise the remote branch of the first refspec is merged.
1073 </p>
1074 </li>
1075 </ol></div>
1076 </div>
1077 <h2 id="_examples">EXAMPLES</h2>
1078 <div class="sectionbody">
1079 <div class="ilist"><ul>
1080 <li>
1082 Update the remote-tracking branches for the repository
1083 you cloned from, then merge one of them into your
1084 current branch:
1085 </p>
1086 <div class="listingblock">
1087 <div class="content">
1088 <pre><tt>$ git pull, git pull origin</tt></pre>
1089 </div></div>
1090 <div class="para"><p>Normally the branch merged in is the HEAD of the remote repository,
1091 but the choice is determined by the branch.&lt;name&gt;.remote and
1092 branch.&lt;name&gt;.merge options; see <a href="git-config.html">git-config(1)</a> for details.</p></div>
1093 </li>
1094 <li>
1096 Merge into the current branch the remote branch <tt>next</tt>:
1097 </p>
1098 <div class="listingblock">
1099 <div class="content">
1100 <pre><tt>$ git pull origin next</tt></pre>
1101 </div></div>
1102 <div class="para"><p>This leaves a copy of <tt>next</tt> temporarily in FETCH_HEAD, but
1103 does not update any remote-tracking branches.</p></div>
1104 </li>
1105 <li>
1107 Bundle local branch <tt>fixes</tt> and <tt>enhancements</tt> on top of
1108 the current branch, making an Octopus merge:
1109 </p>
1110 <div class="listingblock">
1111 <div class="content">
1112 <pre><tt>$ git pull . fixes enhancements</tt></pre>
1113 </div></div>
1114 <div class="para"><p>This <tt>git pull .</tt> syntax is equivalent to <tt>git merge</tt>.</p></div>
1115 </li>
1116 <li>
1118 Merge local branch <tt>obsolete</tt> into the current branch, using <tt>ours</tt>
1119 merge strategy:
1120 </p>
1121 <div class="listingblock">
1122 <div class="content">
1123 <pre><tt>$ git pull -s ours . obsolete</tt></pre>
1124 </div></div>
1125 </li>
1126 <li>
1128 Merge local branch <tt>maint</tt> into the current branch, but do not make
1129 a commit automatically:
1130 </p>
1131 <div class="listingblock">
1132 <div class="content">
1133 <pre><tt>$ git pull --no-commit . maint</tt></pre>
1134 </div></div>
1135 <div class="para"><p>This can be used when you want to include further changes to the
1136 merge, or want to write your own merge commit message.</p></div>
1137 <div class="para"><p>You should refrain from abusing this option to sneak substantial
1138 changes into a merge commit. Small fixups like bumping
1139 release/version name would be acceptable.</p></div>
1140 </li>
1141 <li>
1143 Command line pull of multiple branches from one repository:
1144 </p>
1145 <div class="listingblock">
1146 <div class="content">
1147 <pre><tt>$ git checkout master
1148 $ git fetch origin +pu:pu maint:tmp
1149 $ git pull . tmp</tt></pre>
1150 </div></div>
1151 <div class="para"><p>This updates (or creates, as necessary) branches <tt>pu</tt> and <tt>tmp</tt> in
1152 the local repository by fetching from the branches (respectively)
1153 <tt>pu</tt> and <tt>maint</tt> from the remote repository.</p></div>
1154 <div class="para"><p>The <tt>pu</tt> branch will be updated even if it is does not fast-forward;
1155 the others will not be.</p></div>
1156 <div class="para"><p>The final command then merges the newly fetched <tt>tmp</tt> into master.</p></div>
1157 </li>
1158 </ul></div>
1159 <div class="para"><p>If you tried a pull which resulted in a complex conflicts and
1160 would want to start over, you can recover with <em>git-reset</em>.</p></div>
1161 </div>
1162 <h2 id="_see_also">SEE ALSO</h2>
1163 <div class="sectionbody">
1164 <div class="para"><p><a href="git-fetch.html">git-fetch(1)</a>, <a href="git-merge.html">git-merge(1)</a>, <a href="git-config.html">git-config(1)</a></p></div>
1165 </div>
1166 <h2 id="_author">Author</h2>
1167 <div class="sectionbody">
1168 <div class="para"><p>Written by Linus Torvalds &lt;torvalds@osdl.org&gt;
1169 and Junio C Hamano &lt;gitster@pobox.com&gt;</p></div>
1170 </div>
1171 <h2 id="_documentation">Documentation</h2>
1172 <div class="sectionbody">
1173 <div class="para"><p>Documentation by Jon Loeliger,
1174 David Greaves,
1175 Junio C Hamano and the git-list &lt;git@vger.kernel.org&gt;.</p></div>
1176 </div>
1177 <h2 id="_git">GIT</h2>
1178 <div class="sectionbody">
1179 <div class="para"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1180 </div>
1181 <div id="footer">
1182 <div id="footer-text">
1183 Last updated 2009-07-01 02:30:58 UTC
1184 </div>
1185 </div>
1186 </body>
1187 </html>