6 git-pull - Pull and merge from another repository.
11 'git-pull' <options> <repository> <refspec>...
16 Runs `git-fetch` with the given parameters, and calls `git-merge`
17 to merge the retrieved head(s) into the current branch.
19 Note that you can use `.` (current directory) as the
20 <repository> to pull from the local repository -- this is useful
21 when merging local branches into the current branch.
25 include::pull-fetch-param.txt[]
28 Append ref names and object names of fetched refs to the
29 existing contents of `$GIT_DIR/FETCH_HEAD`. Without this
30 option old data in `$GIT_DIR/FETCH_HEAD` will be overwritten.
32 include::merge-pull-opts.txt[]
39 This can only resolve two heads (i.e. the current branch
40 and another branch you pulled from) using 3-way merge
41 algorithm. It tries to carefully detect criss-cross
42 merge ambiguities and is considered generally safe and
43 fast. This is the default merge strategy when pulling
47 This can only resolve two heads using 3-way merge
48 algorithm. When there are more than one common
49 ancestors that can be used for 3-way merge, it creates a
50 merged tree of the common ancestores and uses that as
51 the reference tree for the 3-way merge. This has been
52 reported to result in fewer merge conflicts without
53 causing mis-merges by tests done on actual merge commits
54 taken from Linux 2.6 kernel development history.
55 Additionally this can detect and handle merges involving
59 This resolves more than two-head case, but refuses to do
60 complex merge that needs manual resolution. It is
61 primarily meant to be used for bundling topic branch
62 heads together. This is the default merge strategy when
63 pulling more than one branch.
66 This resolves any number of heads, but the result of the
67 merge is always the current branch head. It is meant to
68 be used to supersede old development history of side
75 git pull, git pull origin::
76 Fetch the default head from the repository you cloned
77 from and merge it into your current branch.
79 git pull -s ours . obsolete::
80 Merge local branch `obsolete` into the current branch,
81 using `ours` merge strategy.
83 git pull . fixes enhancements::
84 Bundle local branch `fixes` and `enhancements` on top of
85 the current branch, making an Octopus merge.
87 git pull --no-commit . maint::
88 Merge local branch `maint` into the current branch, but
89 do not make a commit automatically. This can be used
90 when you want to include further changes to the merge,
91 or want to write your own merge commit message.
93 You should refrain from abusing this option to sneak substantial
94 changes into a merge commit. Small fixups like bumping
95 release/version name would be acceptable.
97 Command line pull of multiple branches from one repository::
99 ------------------------------------------------
100 $ cat .git/remotes/origin
101 URL: git://git.kernel.org/pub/scm/git/git.git
104 $ git checkout master
105 $ git fetch origin master:origin +pu:pu maint:maint
107 ------------------------------------------------
109 Here, a typical `$GIT_DIR/remotes/origin` file from a
110 `git-clone` operation is used in combination with
111 command line options to `git-fetch` to first update
112 multiple branches of the local repository and then
113 to merge the remote `origin` branch into the local
114 `master` branch. The local `pu` branch is updated
115 even if it does not result in a fast forward update.
116 Here, the pull can obtain its objects from the local
117 repository using `.`, as the previous `git-fetch` is
118 known to have already obtained and made available
119 all the necessary objects.
122 Pull of multiple branches from one repository using `$GIT_DIR/remotes` file::
124 ------------------------------------------------
125 $ cat .git/remotes/origin
126 URL: git://git.kernel.org/pub/scm/git/git.git
131 $ git checkout master
133 ------------------------------------------------
135 Here, a typical `$GIT_DIR/remotes/origin` file from a
136 `git-clone` operation has been hand-modified to include
137 the branch-mapping of additional remote and local
138 heads directly. A single `git-pull` operation while
139 in the `master` branch will fetch multiple heads and
140 merge the remote `origin` head into the current,
141 local `master` branch.
146 gitlink:git-fetch[1], gitlink:git-merge[1]
151 Written by Linus Torvalds <torvalds@osdl.org>
152 and Junio C Hamano <junkio@cox.net>
156 Documentation by Jon Loeliger,
158 Junio C Hamano and the git-list <git@vger.kernel.org>.
162 Part of the gitlink:git[7] suite