1GIT-MERGE(1) Git Manual GIT-MERGE(1)
2
3
4
6 git-merge - Join two or more development histories together
7
9 git merge [-n] [--stat] [--no-commit] [--squash] [--[no-]edit]
10 [--no-verify] [-s <strategy>] [-X <strategy-option>] [-S[<keyid>]]
11 [--[no-]allow-unrelated-histories]
12 [--[no-]rerere-autoupdate] [-m <msg>] [-F <file>]
13 [--into-name <branch>] [<commit>...]
14 git merge (--continue | --abort | --quit)
15
17 Incorporates changes from the named commits (since the time their
18 histories diverged from the current branch) into the current branch.
19 This command is used by git pull to incorporate changes from another
20 repository and can be used by hand to merge changes from one branch
21 into another.
22
23 Assume the following history exists and the current branch is "master":
24
25 A---B---C topic
26 /
27 D---E---F---G master
28
29 Then "git merge topic" will replay the changes made on the topic branch
30 since it diverged from master (i.e., E) until its current commit (C) on
31 top of master, and record the result in a new commit along with the
32 names of the two parent commits and a log message from the user
33 describing the changes.
34
35 A---B---C topic
36 / \
37 D---E---F---G---H master
38
39 The second syntax ("git merge --abort") can only be run after the merge
40 has resulted in conflicts. git merge --abort will abort the merge
41 process and try to reconstruct the pre-merge state. However, if there
42 were uncommitted changes when the merge started (and especially if
43 those changes were further modified after the merge was started), git
44 merge --abort will in some cases be unable to reconstruct the original
45 (pre-merge) changes. Therefore:
46
47 Warning: Running git merge with non-trivial uncommitted changes is
48 discouraged: while possible, it may leave you in a state that is hard
49 to back out of in the case of a conflict.
50
51 The third syntax ("git merge --continue") can only be run after the
52 merge has resulted in conflicts.
53
55 --commit, --no-commit
56 Perform the merge and commit the result. This option can be used to
57 override --no-commit.
58
59 With --no-commit perform the merge and stop just before creating a
60 merge commit, to give the user a chance to inspect and further
61 tweak the merge result before committing.
62
63 Note that fast-forward updates do not create a merge commit and
64 therefore there is no way to stop those merges with --no-commit.
65 Thus, if you want to ensure your branch is not changed or updated
66 by the merge command, use --no-ff with --no-commit.
67
68 --edit, -e, --no-edit
69 Invoke an editor before committing successful mechanical merge to
70 further edit the auto-generated merge message, so that the user can
71 explain and justify the merge. The --no-edit option can be used to
72 accept the auto-generated message (this is generally discouraged).
73 The --edit (or -e) option is still useful if you are giving a draft
74 message with the -m option from the command line and want to edit
75 it in the editor.
76
77 Older scripts may depend on the historical behaviour of not
78 allowing the user to edit the merge log message. They will see an
79 editor opened when they run git merge. To make it easier to adjust
80 such scripts to the updated behaviour, the environment variable
81 GIT_MERGE_AUTOEDIT can be set to no at the beginning of them.
82
83 --cleanup=<mode>
84 This option determines how the merge message will be cleaned up
85 before committing. See git-commit(1) for more details. In addition,
86 if the <mode> is given a value of scissors, scissors will be
87 appended to MERGE_MSG before being passed on to the commit
88 machinery in the case of a merge conflict.
89
90 --ff, --no-ff, --ff-only
91 Specifies how a merge is handled when the merged-in history is
92 already a descendant of the current history. --ff is the default
93 unless merging an annotated (and possibly signed) tag that is not
94 stored in its natural place in the refs/tags/ hierarchy, in which
95 case --no-ff is assumed.
96
97 With --ff, when possible resolve the merge as a fast-forward (only
98 update the branch pointer to match the merged branch; do not create
99 a merge commit). When not possible (when the merged-in history is
100 not a descendant of the current history), create a merge commit.
101
102 With --no-ff, create a merge commit in all cases, even when the
103 merge could instead be resolved as a fast-forward.
104
105 With --ff-only, resolve the merge as a fast-forward when possible.
106 When not possible, refuse to merge and exit with a non-zero status.
107
108 -S[<keyid>], --gpg-sign[=<keyid>], --no-gpg-sign
109 GPG-sign the resulting merge commit. The keyid argument is optional
110 and defaults to the committer identity; if specified, it must be
111 stuck to the option without a space. --no-gpg-sign is useful to
112 countermand both commit.gpgSign configuration variable, and earlier
113 --gpg-sign.
114
115 --log[=<n>], --no-log
116 In addition to branch names, populate the log message with one-line
117 descriptions from at most <n> actual commits that are being merged.
118 See also git-fmt-merge-msg(1).
119
120 With --no-log do not list one-line descriptions from the actual
121 commits being merged.
122
123 --signoff, --no-signoff
124 Add a Signed-off-by trailer by the committer at the end of the
125 commit log message. The meaning of a signoff depends on the project
126 to which you’re committing. For example, it may certify that the
127 committer has the rights to submit the work under the project’s
128 license or agrees to some contributor representation, such as a
129 Developer Certificate of Origin. (See
130 http://developercertificate.org for the one used by the Linux
131 kernel and Git projects.) Consult the documentation or leadership
132 of the project to which you’re contributing to understand how the
133 signoffs are used in that project.
134
135 The --no-signoff option can be used to countermand an earlier
136 --signoff option on the command line.
137
138 --stat, -n, --no-stat
139 Show a diffstat at the end of the merge. The diffstat is also
140 controlled by the configuration option merge.stat.
141
142 With -n or --no-stat do not show a diffstat at the end of the
143 merge.
144
145 --squash, --no-squash
146 Produce the working tree and index state as if a real merge
147 happened (except for the merge information), but do not actually
148 make a commit, move the HEAD, or record $GIT_DIR/MERGE_HEAD (to
149 cause the next git commit command to create a merge commit). This
150 allows you to create a single commit on top of the current branch
151 whose effect is the same as merging another branch (or more in case
152 of an octopus).
153
154 With --no-squash perform the merge and commit the result. This
155 option can be used to override --squash.
156
157 With --squash, --commit is not allowed, and will fail.
158
159 --[no-]verify
160 By default, the pre-merge and commit-msg hooks are run. When
161 --no-verify is given, these are bypassed. See also githooks(5).
162
163 -s <strategy>, --strategy=<strategy>
164 Use the given merge strategy; can be supplied more than once to
165 specify them in the order they should be tried. If there is no -s
166 option, a built-in list of strategies is used instead (ort when
167 merging a single head, octopus otherwise).
168
169 -X <option>, --strategy-option=<option>
170 Pass merge strategy specific option through to the merge strategy.
171
172 --verify-signatures, --no-verify-signatures
173 Verify that the tip commit of the side branch being merged is
174 signed with a valid key, i.e. a key that has a valid uid: in the
175 default trust model, this means the signing key has been signed by
176 a trusted key. If the tip commit of the side branch is not signed
177 with a valid key, the merge is aborted.
178
179 --summary, --no-summary
180 Synonyms to --stat and --no-stat; these are deprecated and will be
181 removed in the future.
182
183 -q, --quiet
184 Operate quietly. Implies --no-progress.
185
186 -v, --verbose
187 Be verbose.
188
189 --progress, --no-progress
190 Turn progress on/off explicitly. If neither is specified, progress
191 is shown if standard error is connected to a terminal. Note that
192 not all merge strategies may support progress reporting.
193
194 --autostash, --no-autostash
195 Automatically create a temporary stash entry before the operation
196 begins, record it in the special ref MERGE_AUTOSTASH and apply it
197 after the operation ends. This means that you can run the operation
198 on a dirty worktree. However, use with care: the final stash
199 application after a successful merge might result in non-trivial
200 conflicts.
201
202 --allow-unrelated-histories
203 By default, git merge command refuses to merge histories that do
204 not share a common ancestor. This option can be used to override
205 this safety when merging histories of two projects that started
206 their lives independently. As that is a very rare occasion, no
207 configuration variable to enable this by default exists and will
208 not be added.
209
210 -m <msg>
211 Set the commit message to be used for the merge commit (in case one
212 is created).
213
214 If --log is specified, a shortlog of the commits being merged will
215 be appended to the specified message.
216
217 The git fmt-merge-msg command can be used to give a good default
218 for automated git merge invocations. The automated message can
219 include the branch description.
220
221 --into-name <branch>
222 Prepare the default merge message as if merging to the branch
223 <branch>, instead of the name of the real branch to which the merge
224 is made.
225
226 -F <file>, --file=<file>
227 Read the commit message to be used for the merge commit (in case
228 one is created).
229
230 If --log is specified, a shortlog of the commits being merged will
231 be appended to the specified message.
232
233 --rerere-autoupdate, --no-rerere-autoupdate
234 After the rerere mechanism reuses a recorded resolution on the
235 current conflict to update the files in the working tree, allow it
236 to also update the index with the result of resolution.
237 --no-rerere-autoupdate is a good way to double-check what rerere
238 did and catch potential mismerges, before committing the result to
239 the index with a separate git add.
240
241 --overwrite-ignore, --no-overwrite-ignore
242 Silently overwrite ignored files from the merge result. This is the
243 default behavior. Use --no-overwrite-ignore to abort.
244
245 --abort
246 Abort the current conflict resolution process, and try to
247 reconstruct the pre-merge state. If an autostash entry is present,
248 apply it to the worktree.
249
250 If there were uncommitted worktree changes present when the merge
251 started, git merge --abort will in some cases be unable to
252 reconstruct these changes. It is therefore recommended to always
253 commit or stash your changes before running git merge.
254
255 git merge --abort is equivalent to git reset --merge when
256 MERGE_HEAD is present unless MERGE_AUTOSTASH is also present in
257 which case git merge --abort applies the stash entry to the
258 worktree whereas git reset --merge will save the stashed changes in
259 the stash list.
260
261 --quit
262 Forget about the current merge in progress. Leave the index and the
263 working tree as-is. If MERGE_AUTOSTASH is present, the stash entry
264 will be saved to the stash list.
265
266 --continue
267 After a git merge stops due to conflicts you can conclude the merge
268 by running git merge --continue (see "HOW TO RESOLVE CONFLICTS"
269 section below).
270
271 <commit>...
272 Commits, usually other branch heads, to merge into our branch.
273 Specifying more than one commit will create a merge with more than
274 two parents (affectionately called an Octopus merge).
275
276 If no commit is given from the command line, merge the
277 remote-tracking branches that the current branch is configured to
278 use as its upstream. See also the configuration section of this
279 manual page.
280
281 When FETCH_HEAD (and no other commit) is specified, the branches
282 recorded in the .git/FETCH_HEAD file by the previous invocation of
283 git fetch for merging are merged to the current branch.
284
286 Before applying outside changes, you should get your own work in good
287 shape and committed locally, so it will not be clobbered if there are
288 conflicts. See also git-stash(1). git pull and git merge will stop
289 without doing anything when local uncommitted changes overlap with
290 files that git pull/git merge may need to update.
291
292 To avoid recording unrelated changes in the merge commit, git pull and
293 git merge will also abort if there are any changes registered in the
294 index relative to the HEAD commit. (Special narrow exceptions to this
295 rule may exist depending on which merge strategy is in use, but
296 generally, the index must match HEAD.)
297
298 If all named commits are already ancestors of HEAD, git merge will exit
299 early with the message "Already up to date."
300
302 Often the current branch head is an ancestor of the named commit. This
303 is the most common case especially when invoked from git pull: you are
304 tracking an upstream repository, you have committed no local changes,
305 and now you want to update to a newer upstream revision. In this case,
306 a new commit is not needed to store the combined history; instead, the
307 HEAD (along with the index) is updated to point at the named commit,
308 without creating an extra merge commit.
309
310 This behavior can be suppressed with the --no-ff option.
311
313 Except in a fast-forward merge (see above), the branches to be merged
314 must be tied together by a merge commit that has both of them as its
315 parents.
316
317 A merged version reconciling the changes from all branches to be merged
318 is committed, and your HEAD, index, and working tree are updated to it.
319 It is possible to have modifications in the working tree as long as
320 they do not overlap; the update will preserve them.
321
322 When it is not obvious how to reconcile the changes, the following
323 happens:
324
325 1. The HEAD pointer stays the same.
326
327 2. The MERGE_HEAD ref is set to point to the other branch head.
328
329 3. Paths that merged cleanly are updated both in the index file and in
330 your working tree.
331
332 4. For conflicting paths, the index file records up to three versions:
333 stage 1 stores the version from the common ancestor, stage 2 from
334 HEAD, and stage 3 from MERGE_HEAD (you can inspect the stages with
335 git ls-files -u). The working tree files contain the result of the
336 "merge" program; i.e. 3-way merge results with familiar conflict
337 markers <<< === >>>.
338
339 5. No other changes are made. In particular, the local modifications
340 you had before you started merge will stay the same and the index
341 entries for them stay as they were, i.e. matching HEAD.
342
343 If you tried a merge which resulted in complex conflicts and want to
344 start over, you can recover with git merge --abort.
345
347 When merging an annotated (and possibly signed) tag, Git always creates
348 a merge commit even if a fast-forward merge is possible, and the commit
349 message template is prepared with the tag message. Additionally, if the
350 tag is signed, the signature check is reported as a comment in the
351 message template. See also git-tag(1).
352
353 When you want to just integrate with the work leading to the commit
354 that happens to be tagged, e.g. synchronizing with an upstream release
355 point, you may not want to make an unnecessary merge commit.
356
357 In such a case, you can "unwrap" the tag yourself before feeding it to
358 git merge, or pass --ff-only when you do not have any work on your own.
359 e.g.
360
361 git fetch origin
362 git merge v1.2.3^0
363 git merge --ff-only v1.2.3
364
366 During a merge, the working tree files are updated to reflect the
367 result of the merge. Among the changes made to the common ancestor’s
368 version, non-overlapping ones (that is, you changed an area of the file
369 while the other side left that area intact, or vice versa) are
370 incorporated in the final result verbatim. When both sides made changes
371 to the same area, however, Git cannot randomly pick one side over the
372 other, and asks you to resolve it by leaving what both sides did to
373 that area.
374
375 By default, Git uses the same style as the one used by the "merge"
376 program from the RCS suite to present such a conflicted hunk, like
377 this:
378
379 Here are lines that are either unchanged from the common
380 ancestor, or cleanly resolved because only one side changed,
381 or cleanly resolved because both sides changed the same way.
382 <<<<<<< yours:sample.txt
383 Conflict resolution is hard;
384 let's go shopping.
385 =======
386 Git makes conflict resolution easy.
387 >>>>>>> theirs:sample.txt
388 And here is another line that is cleanly resolved or unmodified.
389
390 The area where a pair of conflicting changes happened is marked with
391 markers <<<<<<<, =======, and >>>>>>>. The part before the ======= is
392 typically your side, and the part afterwards is typically their side.
393
394 The default format does not show what the original said in the
395 conflicting area. You cannot tell how many lines are deleted and
396 replaced with Barbie’s remark on your side. The only thing you can tell
397 is that your side wants to say it is hard and you’d prefer to go
398 shopping, while the other side wants to claim it is easy.
399
400 An alternative style can be used by setting the "merge.conflictStyle"
401 configuration variable to either "diff3" or "zdiff3". In "diff3" style,
402 the above conflict may look like this:
403
404 Here are lines that are either unchanged from the common
405 ancestor, or cleanly resolved because only one side changed,
406 <<<<<<< yours:sample.txt
407 or cleanly resolved because both sides changed the same way.
408 Conflict resolution is hard;
409 let's go shopping.
410 ||||||| base:sample.txt
411 or cleanly resolved because both sides changed identically.
412 Conflict resolution is hard.
413 =======
414 or cleanly resolved because both sides changed the same way.
415 Git makes conflict resolution easy.
416 >>>>>>> theirs:sample.txt
417 And here is another line that is cleanly resolved or unmodified.
418
419 while in "zdiff3" style, it may look like this:
420
421 Here are lines that are either unchanged from the common
422 ancestor, or cleanly resolved because only one side changed,
423 or cleanly resolved because both sides changed the same way.
424 <<<<<<< yours:sample.txt
425 Conflict resolution is hard;
426 let's go shopping.
427 ||||||| base:sample.txt
428 or cleanly resolved because both sides changed identically.
429 Conflict resolution is hard.
430 =======
431 Git makes conflict resolution easy.
432 >>>>>>> theirs:sample.txt
433 And here is another line that is cleanly resolved or unmodified.
434
435 In addition to the <<<<<<<, =======, and >>>>>>> markers, it uses
436 another ||||||| marker that is followed by the original text. You can
437 tell that the original just stated a fact, and your side simply gave in
438 to that statement and gave up, while the other side tried to have a
439 more positive attitude. You can sometimes come up with a better
440 resolution by viewing the original.
441
443 After seeing a conflict, you can do two things:
444
445 • Decide not to merge. The only clean-ups you need are to reset the
446 index file to the HEAD commit to reverse 2. and to clean up working
447 tree changes made by 2. and 3.; git merge --abort can be used for
448 this.
449
450 • Resolve the conflicts. Git will mark the conflicts in the working
451 tree. Edit the files into shape and git add them to the index. Use
452 git commit or git merge --continue to seal the deal. The latter
453 command checks whether there is a (interrupted) merge in progress
454 before calling git commit.
455
456 You can work through the conflict with a number of tools:
457
458 • Use a mergetool. git mergetool to launch a graphical mergetool
459 which will work you through the merge.
460
461 • Look at the diffs. git diff will show a three-way diff,
462 highlighting changes from both the HEAD and MERGE_HEAD versions.
463
464 • Look at the diffs from each branch. git log --merge -p <path> will
465 show diffs first for the HEAD version and then the MERGE_HEAD
466 version.
467
468 • Look at the originals. git show :1:filename shows the common
469 ancestor, git show :2:filename shows the HEAD version, and git show
470 :3:filename shows the MERGE_HEAD version.
471
473 • Merge branches fixes and enhancements on top of the current branch,
474 making an octopus merge:
475
476 $ git merge fixes enhancements
477
478 • Merge branch obsolete into the current branch, using ours merge
479 strategy:
480
481 $ git merge -s ours obsolete
482
483 • Merge branch maint into the current branch, but do not make a new
484 commit automatically:
485
486 $ git merge --no-commit maint
487
488 This can be used when you want to include further changes to the
489 merge, or want to write your own merge commit message.
490
491 You should refrain from abusing this option to sneak substantial
492 changes into a merge commit. Small fixups like bumping
493 release/version name would be acceptable.
494
496 The merge mechanism (git merge and git pull commands) allows the
497 backend merge strategies to be chosen with -s option. Some strategies
498 can also take their own options, which can be passed by giving
499 -X<option> arguments to git merge and/or git pull.
500
501 ort
502 This is the default merge strategy when pulling or merging one
503 branch. This strategy can only resolve two heads using a 3-way
504 merge algorithm. When there is more than one common ancestor that
505 can be used for 3-way merge, it creates a merged tree of the common
506 ancestors and uses that as the reference tree for the 3-way merge.
507 This has been reported to result in fewer merge conflicts without
508 causing mismerges by tests done on actual merge commits taken from
509 Linux 2.6 kernel development history. Additionally this strategy
510 can detect and handle merges involving renames. It does not make
511 use of detected copies. The name for this algorithm is an acronym
512 ("Ostensibly Recursive’s Twin") and came from the fact that it was
513 written as a replacement for the previous default algorithm,
514 recursive.
515
516 The ort strategy can take the following options:
517
518 ours
519 This option forces conflicting hunks to be auto-resolved
520 cleanly by favoring our version. Changes from the other tree
521 that do not conflict with our side are reflected in the merge
522 result. For a binary file, the entire contents are taken from
523 our side.
524
525 This should not be confused with the ours merge strategy, which
526 does not even look at what the other tree contains at all. It
527 discards everything the other tree did, declaring our history
528 contains all that happened in it.
529
530 theirs
531 This is the opposite of ours; note that, unlike ours, there is
532 no theirs merge strategy to confuse this merge option with.
533
534 ignore-space-change, ignore-all-space, ignore-space-at-eol,
535 ignore-cr-at-eol
536 Treats lines with the indicated type of whitespace change as
537 unchanged for the sake of a three-way merge. Whitespace changes
538 mixed with other changes to a line are not ignored. See also
539 git-diff(1) -b, -w, --ignore-space-at-eol, and
540 --ignore-cr-at-eol.
541
542 • If their version only introduces whitespace changes to a
543 line, our version is used;
544
545 • If our version introduces whitespace changes but their
546 version includes a substantial change, their version is
547 used;
548
549 • Otherwise, the merge proceeds in the usual way.
550
551 renormalize
552 This runs a virtual check-out and check-in of all three stages
553 of a file when resolving a three-way merge. This option is
554 meant to be used when merging branches with different clean
555 filters or end-of-line normalization rules. See "Merging
556 branches with differing checkin/checkout attributes" in
557 gitattributes(5) for details.
558
559 no-renormalize
560 Disables the renormalize option. This overrides the
561 merge.renormalize configuration variable.
562
563 find-renames[=<n>]
564 Turn on rename detection, optionally setting the similarity
565 threshold. This is the default. This overrides the
566 merge.renames configuration variable. See also git-diff(1)
567 --find-renames.
568
569 rename-threshold=<n>
570 Deprecated synonym for find-renames=<n>.
571
572 subtree[=<path>]
573 This option is a more advanced form of subtree strategy, where
574 the strategy makes a guess on how two trees must be shifted to
575 match with each other when merging. Instead, the specified path
576 is prefixed (or stripped from the beginning) to make the shape
577 of two trees to match.
578
579 recursive
580 This can only resolve two heads using a 3-way merge algorithm. When
581 there is more than one common ancestor that can be used for 3-way
582 merge, it creates a merged tree of the common ancestors and uses
583 that as the reference tree for the 3-way merge. This has been
584 reported to result in fewer merge conflicts without causing
585 mismerges by tests done on actual merge commits taken from Linux
586 2.6 kernel development history. Additionally this can detect and
587 handle merges involving renames. It does not make use of detected
588 copies. This was the default strategy for resolving two heads from
589 Git v0.99.9k until v2.33.0.
590
591 The recursive strategy takes the same options as ort. However,
592 there are three additional options that ort ignores (not documented
593 above) that are potentially useful with the recursive strategy:
594
595 patience
596 Deprecated synonym for diff-algorithm=patience.
597
598 diff-algorithm=[patience|minimal|histogram|myers]
599 Use a different diff algorithm while merging, which can help
600 avoid mismerges that occur due to unimportant matching lines
601 (such as braces from distinct functions). See also git-diff(1)
602 --diff-algorithm. Note that ort specifically uses
603 diff-algorithm=histogram, while recursive defaults to the
604 diff.algorithm config setting.
605
606 no-renames
607 Turn off rename detection. This overrides the merge.renames
608 configuration variable. See also git-diff(1) --no-renames.
609
610 resolve
611 This can only resolve two heads (i.e. the current branch and
612 another branch you pulled from) using a 3-way merge algorithm. It
613 tries to carefully detect criss-cross merge ambiguities. It does
614 not handle renames.
615
616 octopus
617 This resolves cases with more than two heads, but refuses to do a
618 complex merge that needs manual resolution. It is primarily meant
619 to be used for bundling topic branch heads together. This is the
620 default merge strategy when pulling or merging more than one
621 branch.
622
623 ours
624 This resolves any number of heads, but the resulting tree of the
625 merge is always that of the current branch head, effectively
626 ignoring all changes from all other branches. It is meant to be
627 used to supersede old development history of side branches. Note
628 that this is different from the -Xours option to the recursive
629 merge strategy.
630
631 subtree
632 This is a modified ort strategy. When merging trees A and B, if B
633 corresponds to a subtree of A, B is first adjusted to match the
634 tree structure of A, instead of reading the trees at the same
635 level. This adjustment is also done to the common ancestor tree.
636
637 With the strategies that use 3-way merge (including the default, ort),
638 if a change is made on both branches, but later reverted on one of the
639 branches, that change will be present in the merged result; some people
640 find this behavior confusing. It occurs because only the heads and the
641 merge base are considered when performing a merge, not the individual
642 commits. The merge algorithm therefore considers the reverted change as
643 no change at all, and substitutes the changed version instead.
644
646 branch.<name>.mergeOptions
647 Sets default options for merging into branch <name>. The syntax and
648 supported options are the same as those of git merge, but option
649 values containing whitespace characters are currently not
650 supported.
651
652 Everything above this line in this section isn’t included from the git-
653 config(1) documentation. The content that follows is the same as what’s
654 found there:
655
656 merge.conflictStyle
657 Specify the style in which conflicted hunks are written out to
658 working tree files upon merge. The default is "merge", which shows
659 a <<<<<<< conflict marker, changes made by one side, a =======
660 marker, changes made by the other side, and then a >>>>>>> marker.
661 An alternate style, "diff3", adds a ||||||| marker and the original
662 text before the ======= marker. The "merge" style tends to produce
663 smaller conflict regions than diff3, both because of the exclusion
664 of the original text, and because when a subset of lines match on
665 the two sides they are just pulled out of the conflict region.
666 Another alternate style, "zdiff3", is similar to diff3 but removes
667 matching lines on the two sides from the conflict region when those
668 matching lines appear near either the beginning or end of a
669 conflict region.
670
671 merge.defaultToUpstream
672 If merge is called without any commit argument, merge the upstream
673 branches configured for the current branch by using their last
674 observed values stored in their remote-tracking branches. The
675 values of the branch.<current branch>.merge that name the branches
676 at the remote named by branch.<current branch>.remote are
677 consulted, and then they are mapped via remote.<remote>.fetch to
678 their corresponding remote-tracking branches, and the tips of these
679 tracking branches are merged. Defaults to true.
680
681 merge.ff
682 By default, Git does not create an extra merge commit when merging
683 a commit that is a descendant of the current commit. Instead, the
684 tip of the current branch is fast-forwarded. When set to false,
685 this variable tells Git to create an extra merge commit in such a
686 case (equivalent to giving the --no-ff option from the command
687 line). When set to only, only such fast-forward merges are allowed
688 (equivalent to giving the --ff-only option from the command line).
689
690 merge.verifySignatures
691 If true, this is equivalent to the --verify-signatures command line
692 option. See git-merge(1) for details.
693
694 merge.branchdesc
695 In addition to branch names, populate the log message with the
696 branch description text associated with them. Defaults to false.
697
698 merge.log
699 In addition to branch names, populate the log message with at most
700 the specified number of one-line descriptions from the actual
701 commits that are being merged. Defaults to false, and true is a
702 synonym for 20.
703
704 merge.suppressDest
705 By adding a glob that matches the names of integration branches to
706 this multi-valued configuration variable, the default merge message
707 computed for merges into these integration branches will omit "into
708 <branch name>" from its title.
709
710 An element with an empty value can be used to clear the list of
711 globs accumulated from previous configuration entries. When there
712 is no merge.suppressDest variable defined, the default value of
713 master is used for backward compatibility.
714
715 merge.renameLimit
716 The number of files to consider in the exhaustive portion of rename
717 detection during a merge. If not specified, defaults to the value
718 of diff.renameLimit. If neither merge.renameLimit nor
719 diff.renameLimit are specified, currently defaults to 7000. This
720 setting has no effect if rename detection is turned off.
721
722 merge.renames
723 Whether Git detects renames. If set to "false", rename detection is
724 disabled. If set to "true", basic rename detection is enabled.
725 Defaults to the value of diff.renames.
726
727 merge.directoryRenames
728 Whether Git detects directory renames, affecting what happens at
729 merge time to new files added to a directory on one side of history
730 when that directory was renamed on the other side of history. If
731 merge.directoryRenames is set to "false", directory rename
732 detection is disabled, meaning that such new files will be left
733 behind in the old directory. If set to "true", directory rename
734 detection is enabled, meaning that such new files will be moved
735 into the new directory. If set to "conflict", a conflict will be
736 reported for such paths. If merge.renames is false,
737 merge.directoryRenames is ignored and treated as false. Defaults to
738 "conflict".
739
740 merge.renormalize
741 Tell Git that canonical representation of files in the repository
742 has changed over time (e.g. earlier commits record text files with
743 CRLF line endings, but recent ones use LF line endings). In such a
744 repository, Git can convert the data recorded in commits to a
745 canonical form before performing a merge to reduce unnecessary
746 conflicts. For more information, see section "Merging branches with
747 differing checkin/checkout attributes" in gitattributes(5).
748
749 merge.stat
750 Whether to print the diffstat between ORIG_HEAD and the merge
751 result at the end of the merge. True by default.
752
753 merge.autoStash
754 When set to true, automatically create a temporary stash entry
755 before the operation begins, and apply it after the operation ends.
756 This means that you can run merge on a dirty worktree. However, use
757 with care: the final stash application after a successful merge
758 might result in non-trivial conflicts. This option can be
759 overridden by the --no-autostash and --autostash options of git-
760 merge(1). Defaults to false.
761
762 merge.tool
763 Controls which merge tool is used by git-mergetool(1). The list
764 below shows the valid built-in values. Any other value is treated
765 as a custom merge tool and requires that a corresponding
766 mergetool.<tool>.cmd variable is defined.
767
768 merge.guitool
769 Controls which merge tool is used by git-mergetool(1) when the
770 -g/--gui flag is specified. The list below shows the valid built-in
771 values. Any other value is treated as a custom merge tool and
772 requires that a corresponding mergetool.<guitool>.cmd variable is
773 defined.
774
775 araxis
776 Use Araxis Merge (requires a graphical session)
777
778 bc
779 Use Beyond Compare (requires a graphical session)
780
781 bc3
782 Use Beyond Compare (requires a graphical session)
783
784 bc4
785 Use Beyond Compare (requires a graphical session)
786
787 codecompare
788 Use Code Compare (requires a graphical session)
789
790 deltawalker
791 Use DeltaWalker (requires a graphical session)
792
793 diffmerge
794 Use DiffMerge (requires a graphical session)
795
796 diffuse
797 Use Diffuse (requires a graphical session)
798
799 ecmerge
800 Use ECMerge (requires a graphical session)
801
802 emerge
803 Use Emacs' Emerge
804
805 examdiff
806 Use ExamDiff Pro (requires a graphical session)
807
808 guiffy
809 Use Guiffy’s Diff Tool (requires a graphical session)
810
811 gvimdiff
812 Use gVim (requires a graphical session) with a custom layout
813 (see git help mergetool's BACKEND SPECIFIC HINTS section)
814
815 gvimdiff1
816 Use gVim (requires a graphical session) with a 2 panes layout
817 (LOCAL and REMOTE)
818
819 gvimdiff2
820 Use gVim (requires a graphical session) with a 3 panes layout
821 (LOCAL, MERGED and REMOTE)
822
823 gvimdiff3
824 Use gVim (requires a graphical session) where only the MERGED
825 file is shown
826
827 kdiff3
828 Use KDiff3 (requires a graphical session)
829
830 meld
831 Use Meld (requires a graphical session) with optional auto
832 merge (see git help mergetool's CONFIGURATION section)
833
834 nvimdiff
835 Use Neovim with a custom layout (see git help mergetool's
836 BACKEND SPECIFIC HINTS section)
837
838 nvimdiff1
839 Use Neovim with a 2 panes layout (LOCAL and REMOTE)
840
841 nvimdiff2
842 Use Neovim with a 3 panes layout (LOCAL, MERGED and REMOTE)
843
844 nvimdiff3
845 Use Neovim where only the MERGED file is shown
846
847 opendiff
848 Use FileMerge (requires a graphical session)
849
850 p4merge
851 Use HelixCore P4Merge (requires a graphical session)
852
853 smerge
854 Use Sublime Merge (requires a graphical session)
855
856 tkdiff
857 Use TkDiff (requires a graphical session)
858
859 tortoisemerge
860 Use TortoiseMerge (requires a graphical session)
861
862 vimdiff
863 Use Vim with a custom layout (see git help mergetool's BACKEND
864 SPECIFIC HINTS section)
865
866 vimdiff1
867 Use Vim with a 2 panes layout (LOCAL and REMOTE)
868
869 vimdiff2
870 Use Vim with a 3 panes layout (LOCAL, MERGED and REMOTE)
871
872 vimdiff3
873 Use Vim where only the MERGED file is shown
874
875 winmerge
876 Use WinMerge (requires a graphical session)
877
878 xxdiff
879 Use xxdiff (requires a graphical session)
880
881 merge.verbosity
882 Controls the amount of output shown by the recursive merge
883 strategy. Level 0 outputs nothing except a final error message if
884 conflicts were detected. Level 1 outputs only conflicts, 2 outputs
885 conflicts and file changes. Level 5 and above outputs debugging
886 information. The default is level 2. Can be overridden by the
887 GIT_MERGE_VERBOSITY environment variable.
888
889 merge.<driver>.name
890 Defines a human-readable name for a custom low-level merge driver.
891 See gitattributes(5) for details.
892
893 merge.<driver>.driver
894 Defines the command that implements a custom low-level merge
895 driver. See gitattributes(5) for details.
896
897 merge.<driver>.recursive
898 Names a low-level merge driver to be used when performing an
899 internal merge between common ancestors. See gitattributes(5) for
900 details.
901
903 git-fmt-merge-msg(1), git-pull(1), gitattributes(5), git-reset(1), git-
904 diff(1), git-ls-files(1), git-add(1), git-rm(1), git-mergetool(1)
905
907 Part of the git(1) suite
908
909
910
911Git 2.39.1 2023-01-13 GIT-MERGE(1)