]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/merge-options.txt
The ninth batch
[thirdparty/git.git] / Documentation / merge-options.txt
CommitLineData
7c85d274
JA
1--commit::
2--no-commit::
3 Perform the merge and commit the result. This option can
4 be used to override --no-commit.
359ff693
EN
5ifdef::git-pull[]
6 Only useful when merging.
7endif::git-pull[]
7c85d274 8+
1ede45e4
EN
9With --no-commit perform the merge and stop just before creating
10a merge commit, to give the user a chance to inspect and further
11tweak the merge result before committing.
12+
13Note that fast-forward updates do not create a merge commit and
14therefore there is no way to stop those merges with --no-commit.
15Thus, if you want to ensure your branch is not changed or updated
16by the merge command, use --no-ff with --no-commit.
93d69d86 17
66f4b98a 18--edit::
66fa1b2c 19-e::
f8246281
JH
20--no-edit::
21 Invoke an editor before committing successful mechanical merge to
22 further edit the auto-generated merge message, so that the user
23 can explain and justify the merge. The `--no-edit` option can be
24 used to accept the auto-generated message (this is generally
08f19cfe
JH
25 discouraged).
26ifndef::git-pull[]
27The `--edit` (or `-e`) option is still useful if you are
28giving a draft message with the `-m` option from the command line
29and want to edit it in the editor.
30endif::git-pull[]
66f4b98a 31+
f8246281
JH
32Older scripts may depend on the historical behaviour of not allowing the
33user to edit the merge log message. They will see an editor opened when
34they run `git merge`. To make it easier to adjust such scripts to the
35updated behaviour, the environment variable `GIT_MERGE_AUTOEDIT` can be
36set to `no` at the beginning of them.
66f4b98a 37
d540b70c 38--cleanup=<mode>::
1055997e 39 This option determines how the merge message will be cleaned up before
031fd4b9 40 committing. See linkgit:git-commit[1] for more details. In addition, if
1055997e
DL
41 the '<mode>' is given a value of `scissors`, scissors will be appended
42 to `MERGE_MSG` before being passed on to the commit machinery in the
43 case of a merge conflict.
d540b70c 44
359ff693 45ifdef::git-merge[]
7c85d274
JA
46--ff::
47--no-ff::
690b2975 48--ff-only::
27fd1e4e
EN
49 Specifies how a merge is handled when the merged-in history is
50 already a descendant of the current history. `--ff` is the
51 default unless merging an annotated (and possibly signed) tag
52 that is not stored in its natural place in the `refs/tags/`
53 hierarchy, in which case `--no-ff` is assumed.
359ff693
EN
54endif::git-merge[]
55ifdef::git-pull[]
56--ff-only::
57 Only update to the new history if there is no divergent local
58 history. This is the default when no method for reconciling
59 divergent histories is provided (via the --rebase=* flags).
60
61--ff::
62--no-ff::
63 When merging rather than rebasing, specifies how a merge is
64 handled when the merged-in history is already a descendant of
65 the current history. If merging is requested, `--ff` is the
66 default unless merging an annotated (and possibly signed) tag
67 that is not stored in its natural place in the `refs/tags/`
68 hierarchy, in which case `--no-ff` is assumed.
69endif::git-pull[]
27fd1e4e
EN
70+
71With `--ff`, when possible resolve the merge as a fast-forward (only
72update the branch pointer to match the merged branch; do not create a
73merge commit). When not possible (when the merged-in history is not a
74descendant of the current history), create a merge commit.
75+
76With `--no-ff`, create a merge commit in all cases, even when the merge
77could instead be resolved as a fast-forward.
359ff693 78ifdef::git-merge[]
27fd1e4e
EN
79+
80With `--ff-only`, resolve the merge as a fast-forward when possible.
81When not possible, refuse to merge and exit with a non-zero status.
359ff693 82endif::git-merge[]
d8abe148 83
488aa65c
TK
84-S[<keyid>]::
85--gpg-sign[=<keyid>]::
5c5bac17 86--no-gpg-sign::
488aa65c
TK
87 GPG-sign the resulting merge commit. The `keyid` argument is
88 optional and defaults to the committer identity; if specified,
5c5bac17
ĐTCD
89 it must be stuck to the option without a space. `--no-gpg-sign`
90 is useful to countermand both `commit.gpgSign` configuration variable,
91 and earlier `--gpg-sign`.
488aa65c 92
96e9420c 93--log[=<n>]::
7c85d274 94--no-log::
efb779f8 95 In addition to branch names, populate the log message with
96e9420c
RR
96 one-line descriptions from at most <n> actual commits that are being
97 merged. See also linkgit:git-fmt-merge-msg[1].
359ff693
EN
98ifdef::git-pull[]
99 Only useful when merging.
100endif::git-pull[]
7c85d274
JA
101+
102With --no-log do not list one-line descriptions from the
103actual commits being merged.
efb779f8 104
ae2e0ab6 105include::signoff-option.txt[]
93d69d86 106
7c85d274
JA
107--stat::
108-n::
109--no-stat::
110 Show a diffstat at the end of the merge. The diffstat is also
111 controlled by the configuration option merge.stat.
112+
113With -n or --no-stat do not show a diffstat at the end of the
114merge.
d08af0ad 115
7d0c6887 116--squash::
7c85d274 117--no-squash::
a58088ab
JL
118 Produce the working tree and index state as if a real merge
119 happened (except for the merge information), but do not actually
120 make a commit, move the `HEAD`, or record `$GIT_DIR/MERGE_HEAD`
121 (to cause the next `git commit` command to create a merge
122 commit). This allows you to create a single commit on top of
123 the current branch whose effect is the same as merging another
124 branch (or more in case of an octopus).
7c85d274
JA
125+
126With --no-squash perform the merge and commit the result. This
127option can be used to override --squash.
1d14d0c9
VV
128+
129With --squash, --commit is not allowed, and will fail.
359ff693
EN
130ifdef::git-pull[]
131+
132Only useful when merging.
133endif::git-pull[]
d66424c4 134
fa21296b
AR
135--[no-]verify::
136 By default, the pre-merge and commit-msg hooks are run.
137 When `--no-verify` is given, these are bypassed.
a1f3dd7e 138 See also linkgit:githooks[5].
359ff693
EN
139ifdef::git-pull[]
140 Only useful when merging.
141endif::git-pull[]
a1f3dd7e 142
3240240f
SB
143-s <strategy>::
144--strategy=<strategy>::
93d69d86
JL
145 Use the given merge strategy; can be supplied more than
146 once to specify them in the order they should be tried.
147 If there is no `-s` option, a built-in list of strategies
f5a3c5e6 148 is used instead (`ort` when merging a single head,
e80178ea 149 `octopus` otherwise).
7c85d274 150
adda3c3b
MB
151-X <option>::
152--strategy-option=<option>::
153 Pass merge strategy specific option through to the merge
154 strategy.
155
efed0022
SG
156--verify-signatures::
157--no-verify-signatures::
05a5869a
KF
158 Verify that the tip commit of the side branch being merged is
159 signed with a valid key, i.e. a key that has a valid uid: in the
160 default trust model, this means the signing key has been signed by
161 a trusted key. If the tip commit of the side branch is not signed
162 with a valid key, the merge is aborted.
359ff693
EN
163ifdef::git-pull[]
164+
165Only useful when merging.
166endif::git-pull[]
efed0022 167
7c85d274
JA
168--summary::
169--no-summary::
170 Synonyms to --stat and --no-stat; these are deprecated and will be
171 removed in the future.
172
409b8d82 173ifndef::git-pull[]
7c85d274
JA
174-q::
175--quiet::
99bfc669 176 Operate quietly. Implies --no-progress.
7c85d274
JA
177
178-v::
179--verbose::
180 Be verbose.
99bfc669
JK
181
182--progress::
183--no-progress::
184 Turn progress on/off explicitly. If neither is specified,
185 progress is shown if standard error is connected to a terminal.
186 Note that not all merge strategies may support progress
187 reporting.
188
409b8d82 189endif::git-pull[]
09c2cb87 190
a03b5553
DL
191--autostash::
192--no-autostash::
193 Automatically create a temporary stash entry before the operation
bc62d27d 194 begins, record it in the ref `MERGE_AUTOSTASH`
fd441eb6 195 and apply it after the operation ends. This means
a03b5553
DL
196 that you can run the operation on a dirty worktree. However, use
197 with care: the final stash application after a successful
198 merge might result in non-trivial conflicts.
199
09c2cb87
JH
200--allow-unrelated-histories::
201 By default, `git merge` command refuses to merge histories
202 that do not share a common ancestor. This option can be
203 used to override this safety when merging histories of two
204 projects that started their lives independently. As that is
205 a very rare occasion, no configuration variable to enable
206 this by default exists and will not be added.
359ff693
EN
207ifdef::git-pull[]
208+
209Only useful when merging.
210endif::git-pull[]