a90b764cc908df3b3af7b180f0940768189b724f
[git/git.git] / Documentation / git-pull.txt
1 git-pull(1)
2 ===========
3
4 NAME
5 ----
6 git-pull - Pull and merge from another repository or a local branch
7
8
9 SYNOPSIS
10 --------
11 'git-pull' <options> <repository> <refspec>...
12
13
14 DESCRIPTION
15 -----------
16 Runs `git-fetch` with the given parameters, and calls `git-merge`
17 to merge the retrieved head(s) into the current branch.
18
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.
22
23
24 OPTIONS
25 -------
26 include::merge-options.txt[]
27
28 include::fetch-options.txt[]
29
30 include::pull-fetch-param.txt[]
31
32 include::urls.txt[]
33
34 include::merge-strategies.txt[]
35
36 EXAMPLES
37 --------
38
39 git pull, git pull origin::
40 Update the remote-tracking branches for the repository
41 you cloned from, then merge one of them into your
42 current branch. Normally the branch merged in is
43 the HEAD of the remote repository, but the choice is
44 determined by the branch.<name>.remote and
45 branch.<name>.merge options; see gitlink:git-repo-config[1]
46 for details.
47
48 git pull origin next::
49 Merge into the current branch the remote branch `next`;
50 leaves a copy of `next` temporarily in FETCH_HEAD, but
51 does not update any remote-tracking branches.
52
53 git pull . fixes enhancements::
54 Bundle local branch `fixes` and `enhancements` on top of
55 the current branch, making an Octopus merge. This `git pull .`
56 syntax is equivalent to `git merge`.
57
58 git pull -s ours . obsolete::
59 Merge local branch `obsolete` into the current branch,
60 using `ours` merge strategy.
61
62 git pull --no-commit . maint::
63 Merge local branch `maint` into the current branch, but
64 do not make a commit automatically. This can be used
65 when you want to include further changes to the merge,
66 or want to write your own merge commit message.
67 +
68 You should refrain from abusing this option to sneak substantial
69 changes into a merge commit. Small fixups like bumping
70 release/version name would be acceptable.
71
72 Command line pull of multiple branches from one repository::
73 +
74 ------------------------------------------------
75 $ git checkout master
76 $ git fetch origin +pu:pu maint:tmp
77 $ git pull . tmp
78 ------------------------------------------------
79 +
80 This updates (or creates, as necessary) branches `pu` and `tmp`
81 in the local repository by fetching from the branches
82 (respectively) `pu` and `maint` from the remote repository.
83 +
84 The `pu` branch will be updated even if it is does not
85 fast-forward; the others will not be.
86 +
87 The final command then merges the newly fetched `tmp` into master.
88
89
90 If you tried a pull which resulted in a complex conflicts and
91 would want to start over, you can recover with
92 gitlink:git-reset[1].
93
94
95 SEE ALSO
96 --------
97 gitlink:git-fetch[1], gitlink:git-merge[1], gitlink:git-repo-config[1]
98
99
100 Author
101 ------
102 Written by Linus Torvalds <torvalds@osdl.org>
103 and Junio C Hamano <junkio@cox.net>
104
105 Documentation
106 --------------
107 Documentation by Jon Loeliger,
108 David Greaves,
109 Junio C Hamano and the git-list <git@vger.kernel.org>.
110
111 GIT
112 ---
113 Part of the gitlink:git[7] suite
114