blob: d8f7cd7ca017f4a257129e19ea7ce407aad5c3e8 [file] [log] [blame]
Junio C Hamanoc21ab052009-10-31 04:03:551--commit::
2--no-commit::
3Perform the merge and commit the result. This option can
4be used to override --no-commit.
Junio C Hamano7a031e52021-08-30 23:54:255ifdef::git-pull[]
6Only useful when merging.
7endif::git-pull[]
Junio C Hamanoc21ab052009-10-31 04:03:558+
Junio C Hamano11f15372019-03-07 03:17:009With --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.
Junio C Hamano610d1762008-11-28 06:27:1317
Junio C Hamano11821ed2011-10-19 18:42:0918--edit::
Junio C Hamano7e590a12013-06-02 23:46:5219-e::
Junio C Hamano795a5a32012-02-02 01:36:3720--no-edit::
21Invoke an editor before committing successful mechanical merge to
22further edit the auto-generated merge message, so that the user
23can explain and justify the merge. The `--no-edit` option can be
24used to accept the auto-generated message (this is generally
Junio C Hamanoc5bd79e2014-01-27 21:31:2625discouraged).
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[]
Junio C Hamano795a5a32012-02-02 01:36:3731+
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.
Junio C Hamano11821ed2011-10-19 18:42:0937
Junio C Hamanod1063b12019-05-08 17:18:0738--cleanup=<mode>::
39This option determines how the merge message will be cleaned up before
Junio C Hamano8ef91f32019-12-01 22:58:2740committing. See linkgit:git-commit[1] for more details. In addition, if
Junio C Hamanod1063b12019-05-08 17:18:0741the '<mode>' is given a value of `scissors`, scissors will be appended
42to `MERGE_MSG` before being passed on to the commit machinery in the
43case of a merge conflict.
44
Junio C Hamano7a031e52021-08-30 23:54:2545ifdef::git-merge[]
Junio C Hamanoc21ab052009-10-31 04:03:5546--ff::
47--no-ff::
Junio C Hamanof54f08e2012-02-27 07:49:1948--ff-only::
Junio C Hamanoa8858312019-09-30 05:07:4549Specifies how a merge is handled when the merged-in history is
50already a descendant of the current history. `--ff` is the
51default unless merging an annotated (and possibly signed) tag
52that is not stored in its natural place in the `refs/tags/`
53hierarchy, in which case `--no-ff` is assumed.
Junio C Hamano7a031e52021-08-30 23:54:2554endif::git-merge[]
55ifdef::git-pull[]
56--ff-only::
57Only update to the new history if there is no divergent local
58history. This is the default when no method for reconciling
59divergent histories is provided (via the --rebase=* flags).
60
61--ff::
62--no-ff::
63When merging rather than rebasing, specifies how a merge is
64handled when the merged-in history is already a descendant of
65the current history. If merging is requested, `--ff` is the
66default unless merging an annotated (and possibly signed) tag
67that is not stored in its natural place in the `refs/tags/`
68hierarchy, in which case `--no-ff` is assumed.
69endif::git-pull[]
Junio C Hamanoa8858312019-09-30 05:07:4570+
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.
Junio C Hamano7a031e52021-08-30 23:54:2578ifdef::git-merge[]
Junio C Hamanoa8858312019-09-30 05:07:4579+
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.
Junio C Hamano7a031e52021-08-30 23:54:2582endif::git-merge[]
Junio C Hamano6d76d612008-05-09 05:46:0883
Junio C Hamanof7e3f472017-10-20 06:45:2484-S[<keyid>]::
85--gpg-sign[=<keyid>]::
Junio C Hamano67bf2242020-04-22 21:41:4486--no-gpg-sign::
Junio C Hamanof7e3f472017-10-20 06:45:2487GPG-sign the resulting merge commit. The `keyid` argument is
88optional and defaults to the committer identity; if specified,
Junio C Hamano67bf2242020-04-22 21:41:4489it must be stuck to the option without a space. `--no-gpg-sign`
90is useful to countermand both `commit.gpgSign` configuration variable,
91and earlier `--gpg-sign`.
Junio C Hamanof7e3f472017-10-20 06:45:2492
Junio C Hamano3b4609d2010-09-30 00:04:3493--log[=<n>]::
Junio C Hamanoc21ab052009-10-31 04:03:5594--no-log::
Junio C Hamano6d76d612008-05-09 05:46:0895In addition to branch names, populate the log message with
Junio C Hamano3b4609d2010-09-30 00:04:3496one-line descriptions from at most <n> actual commits that are being
97merged. See also linkgit:git-fmt-merge-msg[1].
Junio C Hamano7a031e52021-08-30 23:54:2598ifdef::git-pull[]
99Only useful when merging.
100endif::git-pull[]
Junio C Hamanoc21ab052009-10-31 04:03:55101+
102With --no-log do not list one-line descriptions from the
103actual commits being merged.
Junio C Hamano6d76d612008-05-09 05:46:08104
Junio C Hamanodf3d3cd2020-11-02 22:05:05105include::signoff-option.txt[]
Junio C Hamano6d76d612008-05-09 05:46:08106
Junio C Hamanoc21ab052009-10-31 04:03:55107--stat::
108-n::
109--no-stat::
110Show a diffstat at the end of the merge. The diffstat is also
111controlled by the configuration option merge.stat.
112+
113With -n or --no-stat do not show a diffstat at the end of the
114merge.
Junio C Hamano1b50ce92007-10-03 12:05:53115
Junio C Hamano3901ffb2006-06-26 23:46:53116--squash::
Junio C Hamanoc21ab052009-10-31 04:03:55117--no-squash::
Junio C Hamanod75148a2014-04-08 19:48:38118Produce the working tree and index state as if a real merge
119happened (except for the merge information), but do not actually
120make a commit, move the `HEAD`, or record `$GIT_DIR/MERGE_HEAD`
121(to cause the next `git commit` command to create a merge
122commit). This allows you to create a single commit on top of
123the current branch whose effect is the same as merging another
124branch (or more in case of an octopus).
Junio C Hamanoc21ab052009-10-31 04:03:55125+
126With --no-squash perform the merge and commit the result. This
127option can be used to override --squash.
Junio C Hamano73c64862019-06-18 03:24:20128+
129With --squash, --commit is not allowed, and will fail.
Junio C Hamano7a031e52021-08-30 23:54:25130ifdef::git-pull[]
131+
132Only useful when merging.
133endif::git-pull[]
Junio C Hamano1b50ce92007-10-03 12:05:53134
Junio C Hamano5dbbd5d2021-11-04 20:22:31135--[no-]verify::
136By default, the pre-merge and commit-msg hooks are run.
137When `--no-verify` is given, these are bypassed.
Junio C Hamanocb705392019-09-18 19:30:01138See also linkgit:githooks[5].
Junio C Hamano7a031e52021-08-30 23:54:25139ifdef::git-pull[]
140Only useful when merging.
141endif::git-pull[]
Junio C Hamanocb705392019-09-18 19:30:01142
Junio C Hamanoeb415992008-06-08 22:49:47143-s <strategy>::
144--strategy=<strategy>::
Junio C Hamano1a4e8412005-12-27 08:17:23145Use the given merge strategy; can be supplied more than
146once to specify them in the order they should be tried.
147If there is no `-s` option, a built-in list of strategies
Junio C Hamano7a031e52021-08-30 23:54:25148is used instead (`ort` when merging a single head,
149`octopus` otherwise).
Junio C Hamanoc21ab052009-10-31 04:03:55150
Junio C Hamanob04bb3f2010-04-14 14:07:36151-X <option>::
152--strategy-option=<option>::
153Pass merge strategy specific option through to the merge
154strategy.
155
Junio C Hamanoedf80bd2013-04-05 22:14:36156--verify-signatures::
157--no-verify-signatures::
Junio C Hamano198b1f12016-05-17 22:27:24158Verify that the tip commit of the side branch being merged is
159signed with a valid key, i.e. a key that has a valid uid: in the
160default trust model, this means the signing key has been signed by
161a trusted key. If the tip commit of the side branch is not signed
162with a valid key, the merge is aborted.
Junio C Hamano7a031e52021-08-30 23:54:25163ifdef::git-pull[]
164+
165Only useful when merging.
166endif::git-pull[]
Junio C Hamanoedf80bd2013-04-05 22:14:36167
Junio C Hamanoc21ab052009-10-31 04:03:55168--summary::
169--no-summary::
170Synonyms to --stat and --no-stat; these are deprecated and will be
171removed in the future.
172
Junio C Hamanoea90ab32010-03-15 20:32:55173ifndef::git-pull[]
Junio C Hamanoc21ab052009-10-31 04:03:55174-q::
175--quiet::
Junio C Hamanod2c978f2011-03-20 19:42:22176Operate quietly. Implies --no-progress.
Junio C Hamanoc21ab052009-10-31 04:03:55177
178-v::
179--verbose::
180Be verbose.
Junio C Hamanod2c978f2011-03-20 19:42:22181
182--progress::
183--no-progress::
184Turn progress on/off explicitly. If neither is specified,
185progress is shown if standard error is connected to a terminal.
186Note that not all merge strategies may support progress
187reporting.
188
Junio C Hamanoea90ab32010-03-15 20:32:55189endif::git-pull[]
Junio C Hamano7921e7c2016-04-29 21:55:09190
Junio C Hamano67cc2b72020-04-30 00:03:20191--autostash::
192--no-autostash::
193Automatically create a temporary stash entry before the operation
Junio C Hamano2e5fb402021-08-04 21:41:11194begins, record it in the special ref `MERGE_AUTOSTASH`
195and apply it after the operation ends. This means
Junio C Hamano67cc2b72020-04-30 00:03:20196that you can run the operation on a dirty worktree. However, use
197with care: the final stash application after a successful
198merge might result in non-trivial conflicts.
199
Junio C Hamano7921e7c2016-04-29 21:55:09200--allow-unrelated-histories::
201By default, `git merge` command refuses to merge histories
202that do not share a common ancestor. This option can be
203used to override this safety when merging histories of two
204projects that started their lives independently. As that is
205a very rare occasion, no configuration variable to enable
206this by default exists and will not be added.
Junio C Hamano7a031e52021-08-30 23:54:25207ifdef::git-pull[]
208+
209Only useful when merging.
210endif::git-pull[]