]> git.ipfire.org Git - thirdparty/git.git/blob - Documentation/git-pull.txt
Documentation: -merge and -pull: describe merge strategies.
[thirdparty/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.
17
18 When only one ref is downloaded, runs 'git resolve' to merge it
19 into the local HEAD. Otherwise uses 'git octopus' to merge them
20 into the local HEAD.
21
22 Note that you can use '.' (current directory) as the
23 <repository> to pull from the local repository -- this is useful
24 when merging local branches into the current branch.
25
26 OPTIONS
27 -------
28 include::pull-fetch-param.txt[]
29
30 -a, \--append::
31 Append ref names and object names of fetched refs to the
32 existing contents of $GIT_DIR/FETCH_HEAD. Without this
33 option old data in $GIT_DIR/FETCH_HEAD will be overwritten.
34
35 include::merge-pull-opts.txt[]
36
37
38 MERGE STRATEGIES
39 ----------------
40
41 resolve::
42 This can only resolve two heads (i.e. the current branch
43 and another branch you pulled from) using 3-way merge
44 algorithm. It tries to carefully detect criss-cross
45 merge ambiguities and is considered generally safe and
46 fast. This is the default merge strategy when pulling
47 one branch.
48
49 recursive::
50 This can only resolve two heads using 3-way merge
51 algorithm. When there are more than one common
52 ancestors that can be used for 3-way merge, it creates a
53 merged tree of the common ancestores and uses that as
54 the reference tree for the 3-way merge. This has been
55 reported to result in fewer merge conflicts without
56 causing mis-merges by tests done on actual merge commits
57 taken from Linux 2.6 kernel development history.
58 Additionally this can detect and handle merges involving
59 renames.
60
61 octopus::
62 This resolves more than two-head case, but refuses to do
63 complex merge that needs manual resolution. It is
64 primarily meant to be used for bundling topic branch
65 heads together. This is the default merge strategy when
66 pulling more than one branch.
67
68 ours::
69 This resolves any number of heads, but the result of the
70 merge is always the current branch head. It is meant to
71 be used to supersede old development history of side
72 branches.
73
74
75 EXAMPLES
76 --------
77
78 git pull, git pull origin::
79 Fetch the default head from the repository you cloned
80 from and merge it into your current branch.
81
82 git pull -s ours . obsolete::
83 Merge local branch `obsolete` into the current branch,
84 using `ours` merge strategy.
85
86 git pull . fixes enhancements::
87 Bundle local branch `fixes` and `enhancements` on top of
88 the current branch, making an Octopus merge.
89
90 git pull --no-commit . maint::
91 Merge local branch `maint` into the current branch, but
92 do not make a commit automatically. This can be used
93 when you want to include further changes to the merge,
94 or want to write your own merge commit message.
95 +
96 You should refrain from abusing this option to sneak substantial
97 changes into a merge commit. Small fixups like bumping
98 release/version name would be acceptable.
99
100
101 Author
102 ------
103 Written by Linus Torvalds <torvalds@osdl.org>
104 and Junio C Hamano <junkio@cox.net>
105
106 Documentation
107 --------------
108 Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
109
110 GIT
111 ---
112 Part of the gitlink:git[7] suite
113