blob: d8f7cd7ca017f4a257129e19ea7ce407aad5c3e8 [file] [log] [blame]
Jari Aalto7c85d272009-10-22 22:25:20 +03001--commit::
2--no-commit::
3 Perform the merge and commit the result. This option can
4 be used to override --no-commit.
Elijah Newren359ff692021-07-22 05:04:49 +00005ifdef::git-pull[]
6 Only useful when merging.
7endif::git-pull[]
Jari Aalto7c85d272009-10-22 22:25:20 +03008+
Elijah Newren1ede45e2019-02-21 09:50:29 -08009With --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.
Tuncer Ayaz7f87aff2008-11-15 01:14:24 +010017
Jay Soffian66f4b982011-10-08 14:39:52 -040018--edit::
Richard Hansen66fa1b22013-05-16 18:26:00 -040019-e::
Junio C Hamanof8246282012-01-10 22:44:45 -080020--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
Junio C Hamano08f19cf2014-01-14 10:26:21 -080025 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[]
Jay Soffian66f4b982011-10-08 14:39:52 -040031+
Junio C Hamanof8246282012-01-10 22:44:45 -080032Older 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.
Jay Soffian66f4b982011-10-08 14:39:52 -040037
Denton Liud540b702019-04-17 11:23:27 +010038--cleanup=<mode>::
Denton Liu10559972019-04-17 11:23:28 +010039 This option determines how the merge message will be cleaned up before
Elijah Newren031fd4b2019-11-05 17:07:20 +000040 committing. See linkgit:git-commit[1] for more details. In addition, if
Denton Liu10559972019-04-17 11:23:28 +010041 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.
Denton Liud540b702019-04-17 11:23:27 +010044
Elijah Newren359ff692021-07-22 05:04:49 +000045ifdef::git-merge[]
Jari Aalto7c85d272009-10-22 22:25:20 +030046--ff::
47--no-ff::
Junio C Hamano690b2972012-02-22 14:27:07 -080048--ff-only::
Elijah Newren27fd1e42019-08-30 17:23:13 -070049 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.
Elijah Newren359ff692021-07-22 05:04:49 +000054endif::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[]
Elijah Newren27fd1e42019-08-30 17:23:13 -070070+
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.
Elijah Newren359ff692021-07-22 05:04:49 +000078ifdef::git-merge[]
Elijah Newren27fd1e42019-08-30 17:23:13 -070079+
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.
Elijah Newren359ff692021-07-22 05:04:49 +000082endif::git-merge[]
SZEDER Gábord8abe142008-04-06 03:23:43 +020083
W. Trevor King488aa652017-10-12 02:02:17 -070084-S[<keyid>]::
85--gpg-sign[=<keyid>]::
Đoàn Trần Công Danh5c5bac12020-04-03 17:28:07 +070086--no-gpg-sign::
W. Trevor King488aa652017-10-12 02:02:17 -070087 GPG-sign the resulting merge commit. The `keyid` argument is
88 optional and defaults to the committer identity; if specified,
Đoàn Trần Công Danh5c5bac12020-04-03 17:28:07 +070089 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`.
W. Trevor King488aa652017-10-12 02:02:17 -070092
Ramkumar Ramachandra96e94202010-09-08 23:29:54 +053093--log[=<n>]::
Jari Aalto7c85d272009-10-22 22:25:20 +030094--no-log::
SZEDER Gáborefb779f2008-04-06 03:23:46 +020095 In addition to branch names, populate the log message with
Ramkumar Ramachandra96e94202010-09-08 23:29:54 +053096 one-line descriptions from at most <n> actual commits that are being
97 merged. See also linkgit:git-fmt-merge-msg[1].
Elijah Newren359ff692021-07-22 05:04:49 +000098ifdef::git-pull[]
99 Only useful when merging.
100endif::git-pull[]
Jari Aalto7c85d272009-10-22 22:25:20 +0300101+
102With --no-log do not list one-line descriptions from the
103actual commits being merged.
SZEDER Gáborefb779f2008-04-06 03:23:46 +0200104
Junio C Hamanoae2e0ab2020-10-19 18:03:52 -0700105include::signoff-option.txt[]
SZEDER Gáborefb779f2008-04-06 03:23:46 +0200106
Jari Aalto7c85d272009-10-22 22:25:20 +0300107--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.
Lars Hjemlid08af0a2007-09-24 00:51:44 +0200115
Junio C Hamano7d0c6882006-06-23 01:37:02 -0700116--squash::
Jari Aalto7c85d272009-10-22 22:25:20 +0300117--no-squash::
Justin Lebara58088a2014-03-31 15:11:44 -0700118 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).
Jari Aalto7c85d272009-10-22 22:25:20 +0300125+
126With --no-squash perform the merge and commit the result. This
127option can be used to override --squash.
Vishal Verma1d14d0c2019-05-24 12:36:17 -0600128+
129With --squash, --commit is not allowed, and will fail.
Elijah Newren359ff692021-07-22 05:04:49 +0000130ifdef::git-pull[]
131+
132Only useful when merging.
133endif::git-pull[]
Lars Hjemlid66424c2007-09-24 00:51:45 +0200134
Alex Riesenfa212962021-10-29 15:45:45 +0200135--[no-]verify::
136 By default, the pre-merge and commit-msg hooks are run.
137 When `--no-verify` is given, these are bypassed.
Michael J Grubera1f3dd72019-08-07 11:57:06 -0700138 See also linkgit:githooks[5].
Elijah Newren359ff692021-07-22 05:04:49 +0000139ifdef::git-pull[]
140 Only useful when merging.
141endif::git-pull[]
Michael J Grubera1f3dd72019-08-07 11:57:06 -0700142
Stephan Beyer32402402008-06-08 03:36:09 +0200143-s <strategy>::
144--strategy=<strategy>::
Jon Loeliger93d69d82005-11-06 23:30:56 -0600145 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
Elijah Newrenf5a3c5e2021-08-04 05:38:02 +0000148 is used instead (`ort` when merging a single head,
Elijah Newrene80178e2021-08-04 23:50:47 +0000149 `octopus` otherwise).
Jari Aalto7c85d272009-10-22 22:25:20 +0300150
Marc Branchaudadda3c32010-04-12 12:28:13 -0400151-X <option>::
152--strategy-option=<option>::
153 Pass merge strategy specific option through to the merge
154 strategy.
155
Sebastian Götteefed0022013-03-31 18:02:24 +0200156--verify-signatures::
157--no-verify-signatures::
Keller Fuchs05a58692016-05-13 09:51:01 +0000158 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.
Elijah Newren359ff692021-07-22 05:04:49 +0000163ifdef::git-pull[]
164+
165Only useful when merging.
166endif::git-pull[]
Sebastian Götteefed0022013-03-31 18:02:24 +0200167
Jari Aalto7c85d272009-10-22 22:25:20 +0300168--summary::
169--no-summary::
170 Synonyms to --stat and --no-stat; these are deprecated and will be
171 removed in the future.
172
Tay Ray Chuan409b8d82010-02-24 20:50:21 +0800173ifndef::git-pull[]
Jari Aalto7c85d272009-10-22 22:25:20 +0300174-q::
175--quiet::
Jeff King99bfc662011-02-20 04:53:21 -0500176 Operate quietly. Implies --no-progress.
Jari Aalto7c85d272009-10-22 22:25:20 +0300177
178-v::
179--verbose::
180 Be verbose.
Jeff King99bfc662011-02-20 04:53:21 -0500181
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
Tay Ray Chuan409b8d82010-02-24 20:50:21 +0800189endif::git-pull[]
Junio C Hamano09c2cb82016-03-18 13:21:09 -0700190
Denton Liua03b5552020-04-07 10:28:07 -0400191--autostash::
192--no-autostash::
193 Automatically create a temporary stash entry before the operation
Philippe Blainfd441eb2021-07-23 12:14:28 +0000194 begins, record it in the special ref `MERGE_AUTOSTASH`
195 and apply it after the operation ends. This means
Denton Liua03b5552020-04-07 10:28:07 -0400196 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
Junio C Hamano09c2cb82016-03-18 13:21:09 -0700200--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.
Elijah Newren359ff692021-07-22 05:04:49 +0000207ifdef::git-pull[]
208+
209Only useful when merging.
210endif::git-pull[]