1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
\r
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
\r
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
\r
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
\r
6 <meta name="generator" content="AsciiDoc 7.0.1" />
\r
7 <style type="text/css">
\r
9 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
\r
11 border: 1px solid red;
\r
16 margin: 1em 5% 1em 5%;
\r
20 a:visited { color: fuchsia; }
\r
34 h1, h2, h3, h4, h5, h6 {
\r
36 font-family: sans-serif;
\r
38 margin-bottom: 0.5em;
\r
43 border-bottom: 2px solid silver;
\r
46 border-bottom: 2px solid silver;
\r
56 border: 1px solid silver;
\r
61 margin-bottom: 0.5em;
\r
71 font-family: sans-serif;
\r
78 font-family: sans-serif;
\r
82 font-family: sans-serif;
\r
84 border-top: 2px solid silver;
\r
90 padding-bottom: 0.5em;
\r
94 padding-bottom: 0.5em;
\r
98 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
\r
99 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
\r
100 div.admonitionblock {
\r
103 margin-bottom: 1.5em;
\r
105 div.admonitionblock {
\r
107 margin-bottom: 2.5em;
\r
110 div.content { /* Block element content. */
\r
114 /* Block element titles. */
\r
115 div.title, caption.title {
\r
116 font-family: sans-serif;
\r
120 margin-bottom: 0.5em;
\r
126 td div.title:first-child {
\r
129 div.content div.title:first-child {
\r
132 div.content + div.title {
\r
136 div.sidebarblock > div.content {
\r
137 background: #ffffee;
\r
138 border: 1px solid silver;
\r
142 div.listingblock > div.content {
\r
143 border: 1px solid silver;
\r
144 background: #f4f4f4;
\r
148 div.quoteblock > div.content {
\r
149 padding-left: 2.0em;
\r
151 div.quoteblock .attribution {
\r
155 div.admonitionblock .icon {
\r
156 vertical-align: top;
\r
159 text-decoration: underline;
\r
161 padding-right: 0.5em;
\r
163 div.admonitionblock td.content {
\r
164 padding-left: 0.5em;
\r
165 border-left: 2px solid silver;
\r
168 div.exampleblock > div.content {
\r
169 border-left: 2px solid silver;
\r
173 div.verseblock div.content {
\r
177 div.imageblock div.content { padding-left: 0; }
\r
178 div.imageblock img { border: 1px solid silver; }
\r
179 span.image img { border-style: none; }
\r
183 margin-bottom: 0.8em;
\r
188 font-style: italic;
\r
190 dd > *:first-child {
\r
195 list-style-position: outside;
\r
198 list-style-type: lower-alpha;
\r
201 div.tableblock > table {
\r
202 border-color: #527bbd;
\r
206 font-family: sans-serif;
\r
215 margin-bottom: 0.8em;
\r
218 vertical-align: top;
\r
219 font-style: italic;
\r
220 padding-right: 0.8em;
\r
223 vertical-align: top;
\r
227 div#footer-badges { display: none; }
\r
229 include::./stylesheets/xhtml11-manpage.css[]
\r
230 /* Workarounds for IE6's broken and incomplete CSS2. */
\r
232 div.sidebar-content {
\r
233 background: #ffffee;
\r
234 border: 1px solid silver;
\r
237 div.sidebar-title, div.image-title {
\r
238 font-family: sans-serif;
\r
241 margin-bottom: 0.5em;
\r
244 div.listingblock div.content {
\r
245 border: 1px solid silver;
\r
246 background: #f4f4f4;
\r
250 div.quoteblock-content {
\r
251 padding-left: 2.0em;
\r
254 div.exampleblock-content {
\r
255 border-left: 2px solid silver;
\r
256 padding-left: 0.5em;
\r
259 <title>git-pull(1)</title>
\r
264 git-pull(1) Manual Page
\r
267 <div class="sectionbody">
\r
269 Pull and merge from another repository.
\r
274 <div class="sectionbody">
\r
275 <p><em>git-pull</em> <options> <repository> <refspec>…</p>
\r
277 <h2>DESCRIPTION</h2>
\r
278 <div class="sectionbody">
\r
279 <p>Runs <tt>git-fetch</tt> with the given parameters, and calls <tt>git-merge</tt>
\r
280 to merge the retrieved head(s) into the current branch.</p>
\r
281 <p>Note that you can use <tt>.</tt> (current directory) as the
\r
282 <repository> to pull from the local repository — this is useful
\r
283 when merging local branches into the current branch.</p>
\r
286 <div class="sectionbody">
\r
293 Do not show diffstat at the end of the merge.
\r
301 Perform the merge but pretend the merge failed and do
\r
302 not autocommit, to give the user a chance to inspect and
\r
303 further tweak the merge result before committing.
\r
307 -s <strategy>, --strategy=<strategy>
\r
311 Use the given merge strategy; can be supplied more than
\r
312 once to specify them in the order they should be tried.
\r
313 If there is no <tt>-s</tt> option, a built-in list of strategies
\r
314 is used instead (<tt>git-merge-recursive</tt> when merging a single
\r
315 head, <tt>git-merge-octopus</tt> otherwise).
\r
323 Append ref names and object names of fetched refs to the
\r
324 existing contents of <tt>.git/FETCH_HEAD</tt>. Without this
\r
325 option old data in <tt>.git/FETCH_HEAD</tt> will be overwritten.
\r
329 --upload-pack <upload-pack>
\r
333 When given, and the repository to fetch from is handled
\r
334 by <em>git-fetch-pack</em>, <em>--exec=<upload-pack></em> is passed to
\r
335 the command to specify non-default path for the command
\r
336 run on the other end.
\r
344 When <tt>git-fetch</tt> is used with <tt><rbranch>:<lbranch></tt>
\r
345 refspec, it refuses to update the local branch
\r
346 <tt><lbranch></tt> unless the remote branch <tt><rbranch></tt> it
\r
347 fetches is a descendant of <tt><lbranch></tt>. This option
\r
348 overrides that check.
\r
356 By default, <tt>git-fetch</tt> fetches tags that point at
\r
357 objects that are downloaded from the remote repository
\r
358 and stores them locally. This option disables this
\r
359 automatic tag following.
\r
367 Most of the tags are fetched automatically as branch
\r
368 heads are downloaded, but tags that do not point at
\r
369 objects reachable from the branch heads that are being
\r
370 tracked will not be fetched by this mechanism. This
\r
371 flag lets all tags and their associated objects be
\r
380 Keep downloaded pack.
\r
384 -u, --update-head-ok
\r
388 By default <tt>git-fetch</tt> refuses to update the head which
\r
389 corresponds to the current branch. This flag disables the
\r
390 check. Note that fetching into the current branch will not
\r
391 update the index and working directory, so use it with care.
\r
399 The "remote" repository that is the source of a fetch
\r
400 or pull operation, or the destination of a push operation.
\r
401 One of the following notations can be used
\r
402 to name the remote repository:
\r
404 <div class="exampleblock">
\r
405 <div class="exampleblock-content">
\r
409 rsync://host.xz/path/to/repo.git/
\r
414 http://host.xz/path/to/repo.git/
\r
419 https://host.xz/path/to/repo.git/
\r
424 git://host.xz/path/to/repo.git/
\r
429 git://host.xz/~user/path/to/repo.git/
\r
434 ssh://host.xz/path/to/repo.git/
\r
439 ssh://host.xz/~user/path/to/repo.git/
\r
444 ssh://host.xz/~/path/to/repo.git
\r
449 <p>SSH Is the default transport protocol and also supports an
\r
450 scp-like syntax. Both syntaxes support username expansion,
\r
451 as does the native git protocol. The following three are
\r
452 identical to the last three above, respectively:</p>
\r
453 <div class="exampleblock">
\r
454 <div class="exampleblock-content">
\r
458 host.xz:/path/to/repo.git/
\r
463 host.xz:~user/path/to/repo.git/
\r
468 host.xz:path/to/repo.git
\r
473 <p>To sync with a local directory, use:</p>
\r
474 <div class="exampleblock">
\r
475 <div class="exampleblock-content">
\r
484 <p>In addition to the above, as a short-hand, the name of a
\r
485 file in <tt>$GIT_DIR/remotes</tt> directory can be given; the
\r
486 named file should be in the following format:</p>
\r
487 <div class="literalblock">
\r
488 <div class="content">
\r
489 <pre><tt>URL: one of the above URL format
\r
490 Push: <refspec>
\r
491 Pull: <refspec></tt></pre>
\r
493 <p>When such a short-hand is specified in place of
\r
494 <repository> without <refspec> parameters on the command
\r
495 line, <refspec> specified on <tt>Push:</tt> lines or <tt>Pull:</tt>
\r
496 lines are used for <tt>git-push</tt> and <tt>git-fetch</tt>/<tt>git-pull</tt>,
\r
497 respectively. Multiple <tt>Push:</tt> and and <tt>Pull:</tt> lines may
\r
498 be specified for additional branch mappings.</p>
\r
499 <p>The name of a file in <tt>$GIT_DIR/branches</tt> directory can be
\r
500 specified as an older notation short-hand; the named
\r
501 file should contain a single line, a URL in one of the
\r
502 above formats, optionally followed by a hash <tt>#</tt> and the
\r
503 name of remote head (URL fragment notation).
\r
504 <tt>$GIT_DIR/branches/<remote></tt> file that stores a <url>
\r
505 without the fragment is equivalent to have this in the
\r
506 corresponding file in the <tt>$GIT_DIR/remotes/</tt> directory.</p>
\r
507 <div class="literalblock">
\r
508 <div class="content">
\r
509 <pre><tt>URL: <url>
\r
510 Pull: refs/heads/master:<remote></tt></pre>
\r
512 <p>while having <tt><url>#<head></tt> is equivalent to</p>
\r
513 <div class="literalblock">
\r
514 <div class="content">
\r
515 <pre><tt>URL: <url>
\r
516 Pull: refs/heads/<head>:<remote></tt></pre>
\r
524 The canonical format of a <refspec> parameter is
\r
525 <tt>+?<src>:<dst></tt>; that is, an optional plus <tt>+</tt>, followed
\r
526 by the source ref, followed by a colon <tt>:</tt>, followed by
\r
527 the destination ref.
\r
529 <p>When used in <tt>git-push</tt>, the <src> side can be an
\r
530 arbitrary "SHA1 expression" that can be used as an
\r
531 argument to <tt>git-cat-file -t</tt>. E.g. <tt>master~4</tt> (push
\r
532 four parents before the current master head).</p>
\r
533 <p>For <tt>git-push</tt>, the local ref that matches <src> is used
\r
534 to fast forward the remote ref that matches <dst>. If
\r
535 the optional plus <tt>+</tt> is used, the remote ref is updated
\r
536 even if it does not result in a fast forward update.</p>
\r
537 <p>For <tt>git-fetch</tt> and <tt>git-pull</tt>, the remote ref that matches <src>
\r
538 is fetched, and if <dst> is not empty string, the local
\r
539 ref that matches it is fast forwarded using <src>.
\r
540 Again, if the optional plus <tt>+</tt> is used, the local ref
\r
541 is updated even if it does not result in a fast forward
\r
543 <div class="admonitionblock">
\r
546 <div class="title">Note</div>
\r
548 <td class="content">If the remote branch from which you want to pull is
\r
549 modified in non-linear ways such as being rewound and
\r
550 rebased frequently, then a pull will attempt a merge with
\r
551 an older version of itself, likely conflict, and fail.
\r
552 It is under these conditions that you would want to use
\r
553 the <tt>+</tt> sign to indicate non-fast-forward updates will
\r
554 be needed. There is currently no easy way to determine
\r
555 or declare that a branch will be made available in a
\r
556 repository with this behavior; the pulling user simply
\r
557 must know this is the expected usage pattern for a branch.</td>
\r
560 <div class="admonitionblock">
\r
563 <div class="title">Note</div>
\r
565 <td class="content">You never do your own development on branches that appear
\r
566 on the right hand side of a <refspec> colon on <tt>Pull:</tt> lines;
\r
567 they are to be updated by <tt>git-fetch</tt>. If you intend to do
\r
568 development derived from a remote branch <tt>B</tt>, have a <tt>Pull:</tt>
\r
569 line to track it (i.e. <tt>Pull: B:remote-B</tt>), and have a separate
\r
570 branch <tt>my-B</tt> to do your development on top of it. The latter
\r
571 is created by <tt>git branch my-B remote-B</tt> (or its equivalent <tt>git
\r
572 checkout -b my-B remote-B</tt>). Run <tt>git fetch</tt> to keep track of
\r
573 the progress of the remote side, and when you see something new
\r
574 on the remote branch, merge it into your development branch with
\r
575 <tt>git pull . remote-B</tt>, while you are on <tt>my-B</tt> branch.
\r
576 The common <tt>Pull: master:origin</tt> mapping of a remote <tt>master</tt>
\r
577 branch to a local <tt>origin</tt> branch, which is then merged to a
\r
578 local development branch, again typically named <tt>master</tt>, is made
\r
579 when you run <tt>git clone</tt> for you to follow this pattern.</td>
\r
582 <div class="admonitionblock">
\r
585 <div class="title">Note</div>
\r
587 <td class="content">There is a difference between listing multiple <refspec>
\r
588 directly on <tt>git-pull</tt> command line and having multiple
\r
589 <tt>Pull:</tt> <refspec> lines for a <repository> and running
\r
590 <tt>git-pull</tt> command without any explicit <refspec> parameters.
\r
591 <refspec> listed explicitly on the command line are always
\r
592 merged into the current branch after fetching. In other words,
\r
593 if you list more than one remote refs, you would be making
\r
594 an Octopus. While <tt>git-pull</tt> run without any explicit <refspec>
\r
595 parameter takes default <refspec>s from <tt>Pull:</tt> lines, it
\r
596 merges only the first <refspec> found into the current branch,
\r
597 after fetching all the remote refs. This is because making an
\r
598 Octopus from remote refs is rarely done, while keeping track
\r
599 of multiple remote heads in one-go by fetching more than one
\r
600 is often useful.</td>
\r
603 <p>Some short-cut notations are also supported.</p>
\r
607 <tt>tag <tag></tt> means the same as <tt>refs/tags/<tag>:refs/tags/<tag></tt>;
\r
608 used with pull or fetch, it requests fetching everything up to
\r
614 A parameter <ref> without a colon is equivalent to
\r
615 <ref>: when pulling/fetching, and <ref><tt>:</tt><ref> when
\r
616 pushing. That is, do not store it locally if
\r
617 fetching, and update the same name if pushing.
\r
624 <h2>MERGE STRATEGIES</h2>
\r
625 <div class="sectionbody">
\r
632 This can only resolve two heads (i.e. the current branch
\r
633 and another branch you pulled from) using 3-way merge
\r
634 algorithm. It tries to carefully detect criss-cross
\r
635 merge ambiguities and is considered generally safe and
\r
644 This can only resolve two heads using 3-way merge
\r
645 algorithm. When there are more than one common
\r
646 ancestors that can be used for 3-way merge, it creates a
\r
647 merged tree of the common ancestors and uses that as
\r
648 the reference tree for the 3-way merge. This has been
\r
649 reported to result in fewer merge conflicts without
\r
650 causing mis-merges by tests done on actual merge commits
\r
651 taken from Linux 2.6 kernel development history.
\r
652 Additionally this can detect and handle merges involving
\r
653 renames. This is the default merge strategy when
\r
654 pulling or merging one branch.
\r
662 This resolves more than two-head case, but refuses to do
\r
663 complex merge that needs manual resolution. It is
\r
664 primarily meant to be used for bundling topic branch
\r
665 heads together. This is the default merge strategy when
\r
666 pulling or merging more than one branches.
\r
674 This resolves any number of heads, but the result of the
\r
675 merge is always the current branch head. It is meant to
\r
676 be used to supersede old development history of side
\r
683 <div class="sectionbody">
\r
686 git pull, git pull origin
\r
690 Fetch the default head from the repository you cloned
\r
691 from and merge it into your current branch.
\r
695 git pull -s ours . obsolete
\r
699 Merge local branch <tt>obsolete</tt> into the current branch,
\r
700 using <tt>ours</tt> merge strategy.
\r
704 git pull . fixes enhancements
\r
708 Bundle local branch <tt>fixes</tt> and <tt>enhancements</tt> on top of
\r
709 the current branch, making an Octopus merge.
\r
713 git pull --no-commit . maint
\r
717 Merge local branch <tt>maint</tt> into the current branch, but
\r
718 do not make a commit automatically. This can be used
\r
719 when you want to include further changes to the merge,
\r
720 or want to write your own merge commit message.
\r
722 <p>You should refrain from abusing this option to sneak substantial
\r
723 changes into a merge commit. Small fixups like bumping
\r
724 release/version name would be acceptable.</p>
\r
727 Command line pull of multiple branches from one repository
\r
730 <div class="listingblock">
\r
731 <div class="content">
\r
732 <pre><tt>$ cat .git/remotes/origin
\r
733 URL: git://git.kernel.org/pub/scm/git/git.git
\r
734 Pull: master:origin
\r
736 $ git checkout master
\r
737 $ git fetch origin master:origin +pu:pu maint:maint
\r
738 $ git pull . origin</tt></pre>
\r
740 <p>Here, a typical <tt>.git/remotes/origin</tt> file from a
\r
741 <tt>git-clone</tt> operation is used in combination with
\r
742 command line options to <tt>git-fetch</tt> to first update
\r
743 multiple branches of the local repository and then
\r
744 to merge the remote <tt>origin</tt> branch into the local
\r
745 <tt>master</tt> branch. The local <tt>pu</tt> branch is updated
\r
746 even if it does not result in a fast forward update.
\r
747 Here, the pull can obtain its objects from the local
\r
748 repository using <tt>.</tt>, as the previous <tt>git-fetch</tt> is
\r
749 known to have already obtained and made available
\r
750 all the necessary objects.</p>
\r
753 Pull of multiple branches from one repository using <tt>.git/remotes</tt> file
\r
756 <div class="listingblock">
\r
757 <div class="content">
\r
758 <pre><tt>$ cat .git/remotes/origin
\r
759 URL: git://git.kernel.org/pub/scm/git/git.git
\r
760 Pull: master:origin
\r
764 $ git checkout master
\r
765 $ git pull origin</tt></pre>
\r
767 <p>Here, a typical <tt>.git/remotes/origin</tt> file from a
\r
768 <tt>git-clone</tt> operation has been hand-modified to include
\r
769 the branch-mapping of additional remote and local
\r
770 heads directly. A single <tt>git-pull</tt> operation while
\r
771 in the <tt>master</tt> branch will fetch multiple heads and
\r
772 merge the remote <tt>origin</tt> head into the current,
\r
773 local <tt>master</tt> branch.</p>
\r
776 <p>If you tried a pull which resulted in a complex conflicts and
\r
777 would want to start over, you can recover with
\r
778 <a href="git-reset.html">git-reset(1)</a>.</p>
\r
781 <div class="sectionbody">
\r
782 <p><a href="git-fetch.html">git-fetch(1)</a>, <a href="git-merge.html">git-merge(1)</a></p>
\r
785 <div class="sectionbody">
\r
786 <p>Written by Linus Torvalds <torvalds@osdl.org>
\r
787 and Junio C Hamano <junkio@cox.net></p>
\r
789 <h2>Documentation</h2>
\r
790 <div class="sectionbody">
\r
791 <p>Documentation by Jon Loeliger,
\r
793 Junio C Hamano and the git-list <git@vger.kernel.org>.</p>
\r
796 <div class="sectionbody">
\r
797 <p>Part of the <a href="git.html">git(7)</a> suite</p>
\r
800 <div id="footer-text">
\r
801 Last updated 26-Jan-2006 19:38:19 PDT
\r