blob: 51577fcbe638981baf1870006eef633be304e26b [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231git-pull(1)
2===========
3
4NAME
5----
Junio C Hamano01078922006-03-10 00:31:476git-pull - Pull and merge from another repository
Junio C Hamano1a4e8412005-12-27 08:17:237
8
9SYNOPSIS
10--------
11'git-pull' <options> <repository> <refspec>...
12
13
14DESCRIPTION
15-----------
16Runs `git-fetch` with the given parameters, and calls `git-merge`
17to merge the retrieved head(s) into the current branch.
18
19Note that you can use `.` (current directory) as the
20<repository> to pull from the local repository -- this is useful
21when merging local branches into the current branch.
22
23
24OPTIONS
25-------
26include::merge-options.txt[]
27
28include::fetch-options.txt[]
29
30include::pull-fetch-param.txt[]
31
Junio C Hamano40f2f8d2006-02-07 08:04:3932include::urls.txt[]
Junio C Hamano1a4e8412005-12-27 08:17:2333
Junio C Hamano40f2f8d2006-02-07 08:04:3934include::merge-strategies.txt[]
Junio C Hamano1a4e8412005-12-27 08:17:2335
36EXAMPLES
37--------
38
39git pull, git pull origin::
40Fetch the default head from the repository you cloned
41from and merge it into your current branch.
42
43git pull -s ours . obsolete::
44Merge local branch `obsolete` into the current branch,
45using `ours` merge strategy.
46
47git pull . fixes enhancements::
48Bundle local branch `fixes` and `enhancements` on top of
49the current branch, making an Octopus merge.
50
51git pull --no-commit . maint::
52Merge local branch `maint` into the current branch, but
53do not make a commit automatically. This can be used
54when you want to include further changes to the merge,
55or want to write your own merge commit message.
56+
57You should refrain from abusing this option to sneak substantial
58changes into a merge commit. Small fixups like bumping
59release/version name would be acceptable.
60
61Command line pull of multiple branches from one repository::
62+
63------------------------------------------------
64$ cat .git/remotes/origin
65URL: git://git.kernel.org/pub/scm/git/git.git
66Pull: master:origin
67
68$ git checkout master
69$ git fetch origin master:origin +pu:pu maint:maint
70$ git pull . origin
71------------------------------------------------
72+
73Here, a typical `.git/remotes/origin` file from a
74`git-clone` operation is used in combination with
75command line options to `git-fetch` to first update
76multiple branches of the local repository and then
77to merge the remote `origin` branch into the local
78`master` branch. The local `pu` branch is updated
79even if it does not result in a fast forward update.
80Here, the pull can obtain its objects from the local
81repository using `.`, as the previous `git-fetch` is
82known to have already obtained and made available
83all the necessary objects.
84
85
86Pull of multiple branches from one repository using `.git/remotes` file::
87+
88------------------------------------------------
89$ cat .git/remotes/origin
90URL: git://git.kernel.org/pub/scm/git/git.git
91Pull: master:origin
92Pull: +pu:pu
93Pull: maint:maint
94
95$ git checkout master
96$ git pull origin
97------------------------------------------------
98+
99Here, a typical `.git/remotes/origin` file from a
100`git-clone` operation has been hand-modified to include
101the branch-mapping of additional remote and local
102heads directly. A single `git-pull` operation while
103in the `master` branch will fetch multiple heads and
104merge the remote `origin` head into the current,
105local `master` branch.
106
107
108If you tried a pull which resulted in a complex conflicts and
109would want to start over, you can recover with
110gitlink:git-reset[1].
111
112
113SEE ALSO
114--------
115gitlink:git-fetch[1], gitlink:git-merge[1]
116
117
118Author
119------
120Written by Linus Torvalds <torvalds@osdl.org>
121and Junio C Hamano <junkio@cox.net>
122
123Documentation
124--------------
125Documentation by Jon Loeliger,
126David Greaves,
127Junio C Hamano and the git-list <git@vger.kernel.org>.
128
129GIT
130---
131Part of the gitlink:git[7] suite
132