Used by git merge to compose its commit message.
git fmt-merge-msg builds the commit message git merge uses, reading the refs in FETCH_HEAD. You only invoke it directly when scripting custom merge flows.
Plumbing: takes FETCH_HEAD lines on stdin, emits a merge commit subject and optional body. git merge calls it for you; scripts call it when they want to override the wording.
git fmt-merge-msg [--log[=<n>] | --no-log] [--message <msg>] [-F <file>] < $GIT_DIR/FETCH_HEAD
# Driven by config:
# merge.log = false | <n>
# merge.summary = (deprecated alias of merge.log)| Flag | What it does |
|---|---|
--log[=<n>] | Append shortlog of up to <n> commits (default 20) being merged |
--no-log | Suppress the shortlog body — subject only |
--message <msg> | Use <msg> as the subject instead of the default |
-F <file> | Read FETCH_HEAD-style input from <file> instead of stdin |
merge.log | Config: same effect as --log for every merge |
merge.summary | Deprecated alias of merge.log; still honored |
FETCH_HEAD directly.git merge (e.g., server-side merges).git fmt-merge-msg < .git/FETCH_HEADgit fmt-merge-msg --log=50 < .git/FETCH_HEADgit config --global merge.log truegit fmt-merge-msg < .git/FETCH_HEAD | git commit-tree $TREE -p HEAD -p $OTHER -F -merge.log = true (or a number) so merge commits document what came in.FETCH_HEAD rather than editing the message after the fact.--message over post-hoc git commit --amend for reproducible automation.FETCH_HEAD only — if you didn't fetch, there's nothing to summarize.merge.summary still works but is deprecated; use merge.log in new config..mailmap entries produce duplicated author names.Hit each option, then Check answers. Score is recorded; Next is always open.