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