Skip to content
Tutorials Center
My learning

Topics

Git Reference ยท Configuration Options

merge.* settings

Reference for merge.* settings: merge.ff, merge.conflictStyle (merge, diff3, zdiff3), merge.tool, merge.log, merge.renormalize and custom merge drivers.

The merge.* settings tune git merge and everything built on it (pull, cherry-pick, stash apply, revert use the same machinery). The ones people touch most are merge.ff, which controls whether fast-forwards happen, and merge.conflictStyle, which controls how conflicts are written into your files.

Switching merge.conflictStyle to zdiff3 is the single most helpful change for resolving conflicts: it adds the common ancestor's text to each conflict block so you can see what both sides changed from.

Terminal
git config --global merge.conflictStyle zdiff3
git config --global merge.ff false
git config --global merge.tool vimdiff

Try it

Bash Three conflict styles

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.

Bash merge.ff and merge.log

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.

Syntax

Terminal
git config merge.ff (true | false | only)
git config merge.conflictStyle (merge | diff3 | zdiff3)
git config merge.tool <tool>
git config merge.log (true | false | <n>)
git config merge.renormalize (true | false)
git config merge.stat (true | false | compact)
git config merge.autoStash (true | false)
git config merge.verbosity <0-5>
git config merge.<driver>.name <text>
git config merge.<driver>.driver <command>
git config merge.<driver>.recursive <driver>
Name Description
merge.ff true (default) fast-forwards when possible; false always creates a merge commit; only refuses anything but a fast-forward.
merge.conflictStyle merge shows only your side and theirs; diff3 adds the base; zdiff3 is diff3 with common lines moved outside the markers (Git 2.35+).
merge.tool Program started by git mergetool; see merge.<tool>.cmd and merge.<tool>.trustExitCode for custom tools.
merge.log Append up to <n> one-line summaries of merged commits to the message (true means 20).
merge.renormalize Re-run clean filters and line-ending normalization when merging, which resolves conflicts caused only by changed eol rules.
merge.stat Print a diffstat after the merge. compact shortens it.
merge.autoStash Stash local changes before merging and reapply them afterwards.
merge.verbosity 0 silent to 5 debug; default 2.
merge.<driver>.driver Command for a custom merge driver; %O base, %A current (and result), %B other, %L marker size, %P path.

Errors: with merge.ff=only, a diverged merge stops with fatal: Not possible to fast-forward, aborting.. A custom driver that exits non-zero marks the file as conflicted.

Usage notes

  • Prefer zdiff3. The base section tells you whether a line was changed by one side, both sides, or neither; with the default style you must guess. Git versions before 2.35 only have diff3.
  • Markers change, resolution does not. Remove every <<<<<<<, |||||||, ======= and >>>>>>> line when resolving, in whichever style you use.
  • merge.ff=false is how teams get an explicit merge commit per feature branch. --ff-only on the command line still overrides it.
  • Custom drivers are selected through .gitattributes (*.lock merge=ours) and defined here. The built-in merge=binary and merge=union need no configuration.
  • Merge strategy options like -X ours are command-line only; see git merge.
  • Directory renames: merge.directoryRenames controls whether new files are moved when the other side renamed their folder (conflict is the default, asking you).
  • Pull uses these too: a merge-style git pull honors merge.*; see pull.rebase.