]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/git-pull.txt
git-ls-files: Fix, document, and add test for --error-unmatch option.
[thirdparty/git.git] / Documentation / git-pull.txt
CommitLineData
215a7ad1
JH
1git-pull(1)
2===========
2cf565c5
DG
3
4NAME
5----
215a7ad1 6git-pull - Pull and merge from another repository.
2cf565c5
DG
7
8
9SYNOPSIS
10--------
37465016 11'git-pull' <options> <repository> <refspec>...
0c04094b 12
2cf565c5
DG
13
14DESCRIPTION
15-----------
bccf5956
JL
16Runs `git-fetch` with the given parameters, and calls `git-merge`
17to merge the retrieved head(s) into the current branch.
ab9b3138 18
bccf5956 19Note that you can use `.` (current directory) as the
710c97db
JH
20<repository> to pull from the local repository -- this is useful
21when merging local branches into the current branch.
0c04094b 22
93d69d86 23
0c04094b
JH
24OPTIONS
25-------
93d69d86 26include::merge-options.txt[]
2cf565c5 27
93d69d86 28include::fetch-options.txt[]
2cf565c5 29
93d69d86 30include::pull-fetch-param.txt[]
37465016 31
85a97d4e 32include::urls.txt[]
37465016 33
85a97d4e 34include::merge-strategies.txt[]
37465016 35
37465016
JH
36EXAMPLES
37--------
38
39git pull, git pull origin::
40 Fetch the default head from the repository you cloned
41 from and merge it into your current branch.
42
43git pull -s ours . obsolete::
44 Merge local branch `obsolete` into the current branch,
45 using `ours` merge strategy.
46
47git pull . fixes enhancements::
48 Bundle local branch `fixes` and `enhancements` on top of
49 the current branch, making an Octopus merge.
50
51git pull --no-commit . maint::
52 Merge local branch `maint` into the current branch, but
53 do not make a commit automatically. This can be used
54 when you want to include further changes to the merge,
55 or 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
bccf5956
JL
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+
93d69d86 73Here, a typical `.git/remotes/origin` file from a
bccf5956
JL
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
93d69d86 86Pull of multiple branches from one repository using `.git/remotes` file::
bccf5956
JL
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+
93d69d86 99Here, a typical `.git/remotes/origin` file from a
bccf5956
JL
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
37465016 107
3ae854c3
JH
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
fdd08979
JH
113SEE ALSO
114--------
115gitlink:git-fetch[1], gitlink:git-merge[1]
116
117
2cf565c5
DG
118Author
119------
3f971fc4
JH
120Written by Linus Torvalds <torvalds@osdl.org>
121and Junio C Hamano <junkio@cox.net>
2cf565c5
DG
122
123Documentation
124--------------
bccf5956
JL
125Documentation by Jon Loeliger,
126David Greaves,
127Junio C Hamano and the git-list <git@vger.kernel.org>.
2cf565c5
DG
128
129GIT
130---
a7154e91 131Part of the gitlink:git[7] suite
2cf565c5 132