]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/git-pull.txt
mailsplit: allow empty input from stdin
[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
bb73d73c 32include::merge-strategies.txt[]
37465016 33
37465016 34
37465016
JH
35EXAMPLES
36--------
37
38git pull, git pull origin::
39 Fetch the default head from the repository you cloned
40 from and merge it into your current branch.
41
42git pull -s ours . obsolete::
43 Merge local branch `obsolete` into the current branch,
44 using `ours` merge strategy.
45
46git pull . fixes enhancements::
47 Bundle local branch `fixes` and `enhancements` on top of
48 the current branch, making an Octopus merge.
49
50git pull --no-commit . maint::
51 Merge local branch `maint` into the current branch, but
52 do not make a commit automatically. This can be used
53 when you want to include further changes to the merge,
54 or want to write your own merge commit message.
55+
56You should refrain from abusing this option to sneak substantial
57changes into a merge commit. Small fixups like bumping
58release/version name would be acceptable.
59
bccf5956
JL
60Command line pull of multiple branches from one repository::
61+
62------------------------------------------------
63$ cat .git/remotes/origin
64URL: git://git.kernel.org/pub/scm/git/git.git
65Pull: master:origin
66
67$ git checkout master
68$ git fetch origin master:origin +pu:pu maint:maint
69$ git pull . origin
70------------------------------------------------
71+
93d69d86 72Here, a typical `.git/remotes/origin` file from a
bccf5956
JL
73`git-clone` operation is used in combination with
74command line options to `git-fetch` to first update
75multiple branches of the local repository and then
76to merge the remote `origin` branch into the local
77`master` branch. The local `pu` branch is updated
78even if it does not result in a fast forward update.
79Here, the pull can obtain its objects from the local
80repository using `.`, as the previous `git-fetch` is
81known to have already obtained and made available
82all the necessary objects.
83
84
93d69d86 85Pull of multiple branches from one repository using `.git/remotes` file::
bccf5956
JL
86+
87------------------------------------------------
88$ cat .git/remotes/origin
89URL: git://git.kernel.org/pub/scm/git/git.git
90Pull: master:origin
91Pull: +pu:pu
92Pull: maint:maint
93
94$ git checkout master
95$ git pull origin
96------------------------------------------------
97+
93d69d86 98Here, a typical `.git/remotes/origin` file from a
bccf5956
JL
99`git-clone` operation has been hand-modified to include
100the branch-mapping of additional remote and local
101heads directly. A single `git-pull` operation while
102in the `master` branch will fetch multiple heads and
103merge the remote `origin` head into the current,
104local `master` branch.
105
37465016 106
3ae854c3
JH
107If you tried a pull which resulted in a complex conflicts and
108would want to start over, you can recover with
109gitlink:git-reset[1].
110
111
fdd08979
JH
112SEE ALSO
113--------
114gitlink:git-fetch[1], gitlink:git-merge[1]
115
116
2cf565c5
DG
117Author
118------
3f971fc4
JH
119Written by Linus Torvalds <torvalds@osdl.org>
120and Junio C Hamano <junkio@cox.net>
2cf565c5
DG
121
122Documentation
123--------------
bccf5956
JL
124Documentation by Jon Loeliger,
125David Greaves,
126Junio C Hamano and the git-list <git@vger.kernel.org>.
2cf565c5
DG
127
128GIT
129---
a7154e91 130Part of the gitlink:git[7] suite
2cf565c5 131