doc: am: improve command linking and add am.messageId
cover doc: am: improve command linking and add am.messageId
From: Kristoffer Haugsbakk <[email protected]>
Topic name: kh/doc-am-messageid
Topic summary: I noticed that am.messageId was not documented. In the process I thought that the way that git-am(1) refers to commands is a bit off. Replace all things like 'git am'/git rebase with linkgit. Also fill out hook documentation.
Notes to the maintainer: this conflicts with topic kh/doc-am-format-sendmail in seen because of an adjacent paragraph.
Kristoffer Haugsbakk (4):
doc: am: normalize git(1) command links
doc: am: say that --message-id adds a trailer
doc: am: add missing config am.messageId
doc: am: fill out hook discussion
Documentation/config/am.adoc | 24 +++++++++------ Documentation/git-am.adoc | 58 ++++++++++++++++++++---------------- 2 files changed, 47 insertions(+), 35 deletions(-)
base-commit: 67ad42147a7acc2af6074753ebd03d904476118f
Signature · 1 line
2.53.0.26.g2afa8602a26
PATCH 1/4 doc: am: normalize git(1) command links
From: Kristoffer Haugsbakk <[email protected]>
There are many mentions of commands using inline-verbatim or emphasis ('). We just mention the command themselves, not specific invocations like git am <opts>. Let’s link to them instead.
There are also many such mentions which then link to the command right afterwards. Simplify to just using a link.
Also remove “see <gitlink>” phrases where they have now already been mentioned.
--- Documentation/config/am.adoc | 18 +++++++++--------- Documentation/git-am.adoc | 31 +++++++++++++++---------------- 2 files changed, 24 insertions(+), 25 deletions(-)
Documentation/config/am.adoc +9 -9
@@ -1,14 +1,14 @@ am.keepcr:: - If true, git-am will call git-mailsplit for patches in mbox format - with parameter `--keep-cr`. In this case git-mailsplit will + If true, linkgit:git-am[1] will call linkgit:git-mailsplit[1] + for patches in mbox format with parameter `--keep-cr`. In this + case linkgit:git-mailsplit[1] will not remove `\r` from lines ending with `\r\n`. Can be overridden by giving `--no-keep-cr` from the command line. - See linkgit:git-am[1], linkgit:git-mailsplit[1]. am.threeWay:: - By default, `git am` will fail if the patch does not apply cleanly. When - set to true, this setting tells `git am` to fall back on 3-way merge if - the patch records the identity of blobs it is supposed to apply to and - we have those blobs available locally (equivalent to giving the `--3way` - option from the command line). Defaults to `false`. - See linkgit:git-am[1]. + By default, linkgit:git-am[1] will fail if the patch does not + apply cleanly. When set to true, this setting tells + linkgit:git-am[1] to fall back on 3-way merge if the patch + records the identity of blobs it is supposed to apply to and we + have those blobs available locally (equivalent to giving the + `--3way` option from the command line). Defaults to `false`.
Documentation/git-am.adoc +15 -16
@@ -43,14 +43,14 @@ OPTIONS -k:: --keep:: - Pass `-k` flag to 'git mailinfo' (see linkgit:git-mailinfo[1]). + Pass `-k` flag to linkgit:git-mailinfo[1]. --keep-non-patch:: - Pass `-b` flag to 'git mailinfo' (see linkgit:git-mailinfo[1]). + Pass `-b` flag to linkgit:git-mailinfo[1]. --keep-cr:: --no-keep-cr:: - With `--keep-cr`, call 'git mailsplit' (see linkgit:git-mailsplit[1]) + With `--keep-cr`, call linkgit:git-mailsplit[1] with the same option, to prevent it from stripping CR at the end of lines. `am.keepcr` configuration variable can be used to specify the default behaviour. `--no-keep-cr` is useful to override `am.keepcr`.
@@ -65,7 +65,7 @@ OPTIONS Ignore scissors lines (see linkgit:git-mailinfo[1]). --quoted-cr=<action>:: - This flag will be passed down to 'git mailinfo' (see linkgit:git-mailinfo[1]). + This flag will be passed down to linkgit:git-mailinfo[1]. --empty=(drop|keep|stop):: How to handle an e-mail message lacking a patch:
@@ -83,7 +83,7 @@ OPTIONS -m:: --message-id:: - Pass the `-m` flag to 'git mailinfo' (see linkgit:git-mailinfo[1]), + Pass the `-m` flag to linkgit:git-mailinfo[1], so that the Message-ID header is added to the commit message. The `am.messageid` configuration variable can be used to specify the default behaviour.
@@ -98,7 +98,7 @@ OPTIONS -u:: --utf8:: - Pass `-u` flag to 'git mailinfo' (see linkgit:git-mailinfo[1]). + Pass `-u` flag to linkgit:git-mailinfo[1]. The proposed commit log message taken from the e-mail is re-coded into UTF-8 encoding (configuration variable `i18n.commitEncoding` can be used to specify the project's
@@ -108,8 +108,7 @@ This was optional in prior versions of git, but now it is the default. You can use `--no-utf8` to override this. --no-utf8:: - Pass `-n` flag to 'git mailinfo' (see - linkgit:git-mailinfo[1]). + Pass `-n` flag to linkgit:git-mailinfo[1]. -3:: --3way::
@@ -132,9 +131,8 @@ include::rerere-options.adoc[] --exclude=<path>:: --include=<path>:: --reject:: - These flags are passed to the 'git apply' (see linkgit:git-apply[1]) - program that applies - the patch. + These flags are passed to the linkgit:git-apply[1] program that + applies the patch. + Valid <action> for the `--whitespace` option are: `nowarn`, `warn`, `fix`, `error`, and `error-all`.
@@ -205,7 +203,8 @@ applying. to the screen before exiting. This overrides the standard message informing you to use `--continue` or `--skip` to handle the failure. This is solely - for internal use between 'git rebase' and 'git am'. + for internal use between linkgit:git-rebase[1] and + linkgit:git-am[1]. --abort:: Restore the original branch and abort the patching operation.
@@ -223,7 +222,7 @@ applying. failure again. --show-current-patch[=(diff|raw)]:: - Show the message at which `git am` has stopped due to + Show the message at which linkgit:git-am[1] has stopped due to conflicts. If `raw` is specified, show the raw contents of the e-mail message; if `diff`, show the diff portion only. Defaults to `raw`.
@@ -261,7 +260,7 @@ message. Any line that is of the form: is taken as the beginning of a patch, and the commit log message is terminated before the first occurrence of such a line. -When initially invoking `git am`, you give it the names of the mailboxes +When initially invoking linkgit:git-am[1], you give it the names of the mailboxes to process. Upon seeing the first patch that does not apply, it aborts in the middle. You can recover from this in one of two ways:
@@ -279,8 +278,8 @@ names. Before any patches are applied, ORIG_HEAD is set to the tip of the current branch. This is useful if you have problems with multiple -commits, like running 'git am' on the wrong branch or an error in the -commits that is more easily fixed by changing the mailbox (e.g. +commits, like running linkgit:git-am[1] on the wrong branch or an error +in the commits that is more easily fixed by changing the mailbox (e.g. errors in the "From:" lines). HOOKS
Signature · 1 line
2.53.0.26.g2afa8602a26
PATCH 2/4 doc: am: say that --message-id adds a trailer
In reply to [email protected]From: Kristoffer Haugsbakk <[email protected]>
The option --message-id was added in a078f732 (git-am: add --message-id/--no-message-id, 2014-11-25) back when git-interpret- trailers(1) was relatively new. Let’s spell out that it is a trailer and link to the dedicated trailer command.
Also use inline-verbatim for Message-ID.
Also link to git-interpret-trailers(1) on --signoff.
--- Documentation/git-am.adoc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
Documentation/git-am.adoc +9 -7
@@ -37,9 +37,10 @@ OPTIONS -s:: --signoff:: - Add a `Signed-off-by` trailer to the commit message, using - the committer identity of yourself. - See the signoff option in linkgit:git-commit[1] for more information. + Add a `Signed-off-by` trailer to the commit message (see + linkgit:git-interpret-trailers[1]), using the committer identity + of yourself. See the signoff option in linkgit:git-commit[1] + for more information. -k:: --keep::
@@ -83,10 +84,11 @@ OPTIONS -m:: --message-id:: - Pass the `-m` flag to linkgit:git-mailinfo[1], - so that the Message-ID header is added to the commit message. - The `am.messageid` configuration variable can be used to specify - the default behaviour. + Pass the `-m` flag to linkgit:git-mailinfo[1], so that the + `Message-ID` header is added as a trailer (see + linkgit:git-interpret-trailers[1]). The `am.messageid` + configuration variable can be used to specify the default + behaviour. --no-message-id:: Do not add the Message-ID header to the commit message.
Signature · 1 line
2.53.0.26.g2afa8602a26
PATCH 3/4 doc: am: add missing config am.messageId
In reply to [email protected]From: Kristoffer Haugsbakk <[email protected]>
--- Documentation/config/am.adoc | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/config/am.adoc +6 -0
@@ -12,3 +12,9 @@ am.threeWay:: records the identity of blobs it is supposed to apply to and we have those blobs available locally (equivalent to giving the `--3way` option from the command line). Defaults to `false`. + +am.messageId:: + Add a `Message-ID` trailer based on the email header to the + commit when using linkgit:git-am[1] (see + linkgit:git-interpret-trailers[1]). See also the `--message-id` + and `--no-message-id` options.
Signature · 1 line
2.53.0.26.g2afa8602a26
PATCH 4/4 doc: am: fill out hook discussion
In reply to [email protected]From: Kristoffer Haugsbakk <[email protected]>
Document --verify and rephrase the --[no-]verify section to lead with the default, in imperative mood.[1]
Historically it makes sense that only the negated forms are documented; they are all run by default and thus you only need to use hook options if you want to turn some of them off. But, beyond just desiring uniform documentation,[2] it’s very much possible to have, say, a Git alias with --no-verify that you might sometimes want to turn back on with the *positive* form.
Also mention the options in the “Hooks” section and mention that post-applypatch cannot be skipped.
† 1: See e.g. acffc5e9 (doc: convert git-remote to synopsis style,
2025-12-20)
† 2: https://lore.kernel.org/git/[email protected]/
---
Notes (series):
Does not need an update to the usage in builtin/am.c because it is excluded in t/t0450/adoc-help-mismatches.
Documentation/git-am.adoc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
Documentation/git-am.adoc +9 -4
@@ -9,7 +9,7 @@ git-am - Apply a series of patches from a mailbox SYNOPSIS -------- [verse] -'git am' [--signoff] [--keep] [--[no-]keep-cr] [--[no-]utf8] [--no-verify] +'git am' [--signoff] [--keep] [--[no-]keep-cr] [--[no-]utf8] [--[no-]verify] [--[no-]3way] [--interactive] [--committer-date-is-author-date] [--ignore-date] [--ignore-space-change | --ignore-whitespace] [--whitespace=<action>] [-C<n>] [-p<n>] [--directory=<dir>]
@@ -150,11 +150,14 @@ Valid <action> for the `--whitespace` option are: --interactive:: Run interactively. +--verify:: -n:: --no-verify:: - By default, the pre-applypatch and applypatch-msg hooks are run. - When any of `--no-verify` or `-n` is given, these are bypassed. - See also linkgit:githooks[5]. + Run the `pre-applypatch` and `applypatch-msg` hooks. This is the + default. Skip these hooks with `-n` or `--no-verify`. See also + linkgit:githooks[5]. ++ +Note that `post-applypatch` cannot be skipped. --committer-date-is-author-date:: By default the command records the date from the e-mail
@@ -290,6 +293,8 @@ This command can run `applypatch-msg`, `pre-applypatch`, and `post-applypatch` hooks. See linkgit:githooks[5] for more information. +See the `--verify`/`-n`/`--no-verify` options. + CONFIGURATION -------------
Signature · 1 line
2.53.0.26.g2afa8602a26
Quoted 19 lines · On Mon, Feb 9, 2026 at 12:35 PM <[email protected]> wrote:
From: Kristoffer Haugsbakk <[email protected]>
Topic name: kh/doc-am-messageid
Topic summary: I noticed that
am.messageIdwas not documented. In the process I thought that the way that git-am(1) refers to commands is a bit off. Replace all things like 'git am'/git rebasewithlinkgit. Also fill out hook documentation.Notes to the maintainer: this conflicts with topic kh/doc-am-format-sendmail in
seenbecause of an adjacent paragraph.Kristoffer Haugsbakk (4):
doc: am: normalize git(1) command links
doc: am: say that --message-id adds a trailer
doc: am: add missing config am.messageId
doc: am: fill out hook discussion
Quoted 8 lines
Documentation/config/am.adoc | 24 +++++++++------ Documentation/git-am.adoc | 58 ++++++++++++++++++++---------------- 2 files changed, 47 insertions(+), 35 deletions(-)base-commit:
67ad42147a7acc2af6074753ebd03d904476118f--
2.53.0.26.g2afa8602a26
From a quick glance I don't spot any issues. Thanks!
Signature · 1 line
D. Ben Knoble
Quoted 25 lines · D. Ben Knoble
Quoted 24 lines · On Mon, Feb 9, 2026 at 12:35 PM <[email protected]> wrote:
From: Kristoffer Haugsbakk <[email protected]>
Topic name: kh/doc-am-messageid
Topic summary: I noticed that
am.messageIdwas not documented. In the process I thought that the way that git-am(1) refers to commands is a bit off. Replace all things like 'git am'/git rebasewithlinkgit. Also fill out hook documentation.Notes to the maintainer: this conflicts with topic kh/doc-am-format-sendmail in
seenbecause of an adjacent paragraph.Kristoffer Haugsbakk (4):
doc: am: normalize git(1) command links
doc: am: say that --message-id adds a trailer
doc: am: add missing config am.messageId
doc: am: fill out hook discussionDocumentation/config/am.adoc | 24 +++++++++------ Documentation/git-am.adoc | 58 ++++++++++++++++++++---------------- 2 files changed, 47 insertions(+), 35 deletions(-)
Quoted 5 lines
Quoted 3 lines
base-commit:
67ad42147a7acc2af6074753ebd03d904476118f--
2.53.0.26.g2afa8602a26From a quick glance I don't spot any issues. Thanks!
Yeah, thanks, both. Queued.
Re: [PATCH 1/4] doc: am: normalize git(1) command links
In reply to [email protected]Quoted 19 lines · On Mon, Feb 9, 2026, at 18:34, [email protected] wrote:
From: Kristoffer Haugsbakk <[email protected]>
There are many mentions of commands using inline-verbatim or emphasis ('). We just mention the command themselves, not specific invocations like
git am <opts>. Let’s link to them instead.There are also many such mentions which then link to the command right afterwards. Simplify to just using a link.
Also remove “see <gitlink>” phrases where they have now already been mentioned.
Signed-off-by Kristoffer Haugsbakk <[email protected]>[snip]Documentation/git-am.adoc +0
-0Valid <action> for the `--whitespace` option are: `nowarn`, `warn`, `fix`, `error`, and `error-all`.
Documentation/git-am.adoc applying. · line 207
Quoted 6 lines
Documentation/git-am.adoc +2
-1@@ -205,7 +203,8 @@ applying. to the screen before exiting. This overrides the standard message informing you to use `--continue` or `--skip` to handle the failure. This is solely - for internal use between 'git rebase' and 'git am'. + for internal use between linkgit:git-rebase[1] and + linkgit:git-am[1].
Jean-Noël, regarding [this]. This change adds a lot of self-references:
git-am(1) inside the git-am(1) doc. Is that problematic?
Quoted 1 line
[snip]