doc: convert git tag to synopsis style

- Switch the synopsis to a synopsis block which will automatically format placeholders in italics and keywords in monospace - Use _<placeholder>_ instead of <placeholder> in the description - Use `backticks` for keywords and more complex option descriptions. The new rendering engine will apply synopsis rules to these spans. Also add the config section in the manual page and do not refer to the man page in the description of settings when this description is already in the man page. Signed-off-by: Jean-Noël Avila <jn.avila@free.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jean-Noël Avila committed Oct 5, 2025 at 21:11 UTC 0fc3a21a9e9259b942050ed8dc67a04f2371d36b
2 files changed +104 -91
Documentation/config/tag.adoc
+14 -8
@@ -1,17 +1,23 @@
1 -tag.forceSignAnnotated::
1 +`tag.forceSignAnnotated`::
2 A boolean to specify whether annotated tags created should be GPG signed.
3 If `--annotate` is specified on the command line, it takes
4 precedence over this option.
5
6 -tag.sort::
7 - This variable controls the sort ordering of tags when displayed by
8 - linkgit:git-tag[1]. Without the "--sort=<value>" option provided, the
9 - value of this variable will be used as the default.
6 +`tag.sort`::
7 +ifdef::git-tag[]
8 +This variable controls the sort ordering of tags when displayed by `git-tag`.
9 +endif::git-tag[]
10 +ifndef::git-tag[]
11 +This variable controls the sort ordering of tags when displayed by
12 +linkgit:git-tag[1].
13 +endif::git-tag[]
14 +Without the `--sort=<value>` option provided, the value of this variable will
15 +be used as the default.
16
11 -tag.gpgSign::
17 +`tag.gpgSign`::
18 A boolean to specify whether all tags should be GPG signed.
19 Use of this option when running in an automated script can
20 result in a large number of tags being signed. It is therefore
15 - convenient to use an agent to avoid typing your gpg passphrase
21 + convenient to use an agent to avoid typing your GPG passphrase
22 several times. Note that this option doesn't affect tag signing
17 - behavior enabled by "-u <keyid>" or "--local-user=<keyid>" options.
23 + behavior enabled by `-u <keyid>` or `--local-user=<keyid>` options.
Documentation/git-tag.adoc
+90 -83
@@ -8,21 +8,21 @@ git-tag - Create, list, delete or verify a tag object signed with GPG
8
9 SYNOPSIS
10 --------
11 -[verse]
12 -'git tag' [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] [-e]
11 +[synopsis]
12 +git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] [-e]
13 [(--trailer <token>[(=|:)<value>])...]
14 <tagname> [<commit> | <object>]
15 -'git tag' -d <tagname>...
16 -'git tag' [-n[<num>]] -l [--contains <commit>] [--no-contains <commit>]
15 +git tag -d <tagname>...
16 +git tag [-n[<num>]] -l [--contains <commit>] [--no-contains <commit>]
17 [--points-at <object>] [--column[=<options>] | --no-column]
18 [--create-reflog] [--sort=<key>] [--format=<format>]
19 [--merged <commit>] [--no-merged <commit>] [<pattern>...]
20 -'git tag' -v [--format=<format>] <tagname>...
20 +git tag -v [--format=<format>] <tagname>...
21
22 DESCRIPTION
23 -----------
24
25 -Add a tag reference in `refs/tags/`, unless `-d/-l/-v` is given
25 +Add a tag reference in `refs/tags/`, unless `-d`/`-l`/`-v` is given
26 to delete, list or verify tags.
27
28 Unless `-f` is given, the named tag must not yet exist.
@@ -58,129 +58,129 @@ lightweight tags by default.
58
59 OPTIONS
60 -------
61 --a::
62 ---annotate::
61 +`-a`::
62 +`--annotate`::
63 Make an unsigned, annotated tag object
64
65 --s::
66 ---sign::
65 +`-s`::
66 +`--sign`::
67 Make a GPG-signed tag, using the default e-mail address's key.
68 The default behavior of tag GPG-signing is controlled by `tag.gpgSign`
69 configuration variable if it exists, or disabled otherwise.
70 See linkgit:git-config[1].
71
72 ---no-sign::
72 +`--no-sign`::
73 Override `tag.gpgSign` configuration variable that is
74 set to force each and every tag to be signed.
75
76 --u <key-id>::
77 ---local-user=<key-id>::
76 +`-u <key-id>`::
77 +`--local-user=<key-id>`::
78 Make a GPG-signed tag, using the given key.
79
80 --f::
81 ---force::
80 +`-f`::
81 +`--force`::
82 Replace an existing tag with the given name (instead of failing)
83
84 --d::
85 ---delete::
84 +`-d`::
85 +`--delete`::
86 Delete existing tags with the given names.
87
88 --v::
89 ---verify::
88 +`-v`::
89 +`--verify`::
90 Verify the GPG signature of the given tag names.
91
92 --n<num>::
93 - <num> specifies how many lines from the annotation, if any,
94 - are printed when using -l. Implies `--list`.
92 +`-n<num>`::
93 + _<num>_ specifies how many lines from the annotation, if any,
94 + are printed when using `-l`. Implies `--list`.
95 +
96 The default is not to print any annotation lines.
97 If no number is given to `-n`, only the first line is printed.
98 If the tag is not annotated, the commit message is displayed instead.
99
100 --l::
101 ---list::
100 +`-l`::
101 +`--list`::
102 List tags. With optional `<pattern>...`, e.g. `git tag --list
103 'v-*'`, list only the tags that match the pattern(s).
104 +
105 -Running "git tag" without arguments also lists all tags. The pattern
106 -is a shell wildcard (i.e., matched using fnmatch(3)). Multiple
105 +Running `git tag` without arguments also lists all tags. The pattern
106 +is a shell wildcard (i.e., matched using `fnmatch`(3)). Multiple
107 patterns may be given; if any of them matches, the tag is shown.
108 +
109 This option is implicitly supplied if any other list-like option such
110 as `--contains` is provided. See the documentation for each of those
111 options for details.
112
113 ---sort=<key>::
113 +`--sort=<key>`::
114 Sort based on the key given. Prefix `-` to sort in
115 - descending order of the value. You may use the --sort=<key> option
116 - multiple times, in which case the last key becomes the primary
117 - key. Also supports "version:refname" or "v:refname" (tag
118 - names are treated as versions). The "version:refname" sort
119 - order can also be affected by the "versionsort.suffix"
115 + descending order of the value. You may use the `--sort=<key>` option
116 + multiple times, in which case the last _<key>_ becomes the primary
117 + key. Also supports "`version:refname`" or "`v:refname`" (tag
118 + names are treated as versions). The "`version:refname`" sort
119 + order can also be affected by the "`versionsort.suffix`"
120 configuration variable.
121 The keys supported are the same as those in `git for-each-ref`.
122 Sort order defaults to the value configured for the `tag.sort`
123 variable if it exists, or lexicographic order otherwise. See
124 linkgit:git-config[1].
125
126 ---color[=<when>]::
126 +`--color[=<when>]`::
127 Respect any colors specified in the `--format` option. The
128 - `<when>` field must be one of `always`, `never`, or `auto` (if
129 - `<when>` is absent, behave as if `always` was given).
128 + _<when>_ field must be one of `always`, `never`, or `auto` (if
129 + _<when>_ is absent, behave as if `always` was given).
130
131 --i::
132 ---ignore-case::
131 +`-i`::
132 +`--ignore-case`::
133 Sorting and filtering tags are case insensitive.
134
135 ---omit-empty::
135 +`--omit-empty`::
136 Do not print a newline after formatted refs where the format expands
137 to the empty string.
138
139 ---column[=<options>]::
140 ---no-column::
139 +`--column[=<options>]`::
140 +`--no-column`::
141 Display tag listing in columns. See configuration variable
142 `column.tag` for option syntax. `--column` and `--no-column`
143 - without options are equivalent to 'always' and 'never' respectively.
143 + without options are equivalent to `always` and `never` respectively.
144 +
145 This option is only applicable when listing tags without annotation lines.
146
147 ---contains [<commit>]::
148 - Only list tags which contain the specified commit (HEAD if not
147 +`--contains [<commit>]`::
148 + Only list tags which contain _<commit>_ (`HEAD` if not
149 specified). Implies `--list`.
150
151 ---no-contains [<commit>]::
152 - Only list tags which don't contain the specified commit (HEAD if
151 +`--no-contains [<commit>]`::
152 + Only list tags which don't contain _<commit>_ (`HEAD` if
153 not specified). Implies `--list`.
154
155 ---merged [<commit>]::
156 - Only list tags whose commits are reachable from the specified
157 - commit (`HEAD` if not specified).
155 +`--merged [<commit>]`::
156 + Only list tags whose commits are reachable from
157 + _<commit>_ (`HEAD` if not specified).
158
159 ---no-merged [<commit>]::
160 - Only list tags whose commits are not reachable from the specified
161 - commit (`HEAD` if not specified).
159 +`--no-merged [<commit>]`::
160 + Only list tags whose commits are not reachable from
161 + _<commit>_ (`HEAD` if not specified).
162
163 ---points-at <object>::
164 - Only list tags of the given object (HEAD if not
163 +`--points-at [<object>]`::
164 + Only list tags of _<object>_ (`HEAD` if not
165 specified). Implies `--list`.
166
167 --m <msg>::
168 ---message=<msg>::
169 - Use the given tag message (instead of prompting).
167 +`-m <msg>`::
168 +`--message=<msg>`::
169 + Use _<msg>_ (instead of prompting).
170 If multiple `-m` options are given, their values are
171 concatenated as separate paragraphs.
172 Implies `-a` if none of `-a`, `-s`, or `-u <key-id>`
173 is given.
174
175 --F <file>::
176 ---file=<file>::
177 - Take the tag message from the given file. Use '-' to
175 +`-F <file>`::
176 +`--file=<file>`::
177 + Take the tag message from _<file>_. Use `-` to
178 read the message from the standard input.
179 Implies `-a` if none of `-a`, `-s`, or `-u <key-id>`
180 is given.
181
182 ---trailer <token>[(=|:)<value>]::
183 - Specify a (<token>, <value>) pair that should be applied as a
182 +`--trailer <token>[(=|:)<value>]`::
183 + Specify a (_<token>_, _<value>_) pair that should be applied as a
184 trailer. (e.g. `git tag --trailer "Custom-Key: value"`
185 will add a "Custom-Key" trailer to the tag message.)
186 The `trailer.*` configuration variables
@@ -190,46 +190,45 @@ This option is only applicable when listing tags without annotation lines.
190 The trailers can be extracted in `git tag --list`, using
191 `--format="%(trailers)"` placeholder.
192
193 --e::
194 ---edit::
195 - The message taken from file with `-F` and command line with
196 - `-m` are usually used as the tag message unmodified.
197 - This option lets you further edit the message taken from these sources.
193 +`-e`::
194 +`--edit`::
195 + Let further edit the message taken from file with `-F` and command line with
196 + `-m`.
197
199 ---cleanup=<mode>::
200 - This option sets how the tag message is cleaned up.
201 - The '<mode>' can be one of 'verbatim', 'whitespace' and 'strip'. The
202 - 'strip' mode is default. The 'verbatim' mode does not change message at
203 - all, 'whitespace' removes just leading/trailing whitespace lines and
204 - 'strip' removes both whitespace and commentary.
198 +`--cleanup=<mode>`::
199 + Set how the tag message is cleaned up.
200 + The _<mode>_ can be one of `verbatim`, `whitespace` and `strip`. The
201 + `strip` mode is default. The `verbatim` mode does not change message at
202 + all, `whitespace` removes just leading/trailing whitespace lines and
203 + `strip` removes both whitespace and commentary.
204
206 ---create-reflog::
205 +`--create-reflog`::
206 Create a reflog for the tag. To globally enable reflogs for tags, see
207 `core.logAllRefUpdates` in linkgit:git-config[1].
208 The negated form `--no-create-reflog` only overrides an earlier
209 `--create-reflog`, but currently does not negate the setting of
210 `core.logAllRefUpdates`.
211
213 ---format=<format>::
212 +`--format=<format>`::
213 A string that interpolates `%(fieldname)` from a tag ref being shown
214 and the object it points at. The format is the same as
215 that of linkgit:git-for-each-ref[1]. When unspecified,
216 defaults to `%(refname:strip=2)`.
217
219 -<tagname>::
218 +_<tagname>_::
219 The name of the tag to create, delete, or describe.
220 The new tag name must pass all checks defined by
221 linkgit:git-check-ref-format[1]. Some of these checks
222 may restrict the characters allowed in a tag name.
223
225 -<commit>::
226 -<object>::
224 +_<commit>_::
225 +_<object>_::
226 The object that the new tag will refer to, usually a commit.
228 - Defaults to HEAD.
227 + Defaults to `HEAD`.
228
229 CONFIGURATION
230 -------------
232 -By default, 'git tag' in sign-with-default mode (-s) will use your
231 +By default, `git tag` in sign-with-default mode (`-s`) will use your
232 committer identity (of the form `Your Name <your@email.address>`) to
233 find a key. If you want to use a different default key, you can specify
234 it in the repository configuration as follows:
@@ -252,7 +251,7 @@ On Re-tagging
251 What should you do when you tag a wrong commit and you would
252 want to re-tag?
253
255 -If you never pushed anything out, just re-tag it. Use "-f" to
254 +If you never pushed anything out, just re-tag it. Use `-f` to
255 replace the old one. And you're done.
256
257 But if you have pushed things out (or others could just read
@@ -268,12 +267,12 @@ the old tag. In that case you can do one of two things:
267
268 . The insane thing.
269 You really want to call the new version "X" too, 'even though'
271 - others have already seen the old one. So just use 'git tag -f'
270 + others have already seen the old one. So just use `git tag -f`
271 again, as if you hadn't already published the old one.
272
273 However, Git does *not* (and it should not) change tags behind
274 users back. So if somebody already got the old tag, doing a
276 -'git pull' on your tree shouldn't just make them overwrite the old
275 +`git pull` on your tree shouldn't just make them overwrite the old
276 one.
277
278 If somebody got a release tag from you, you cannot just change
@@ -325,7 +324,7 @@ private anchor point tags from the other person.
324
325 Often, "please pull" messages on the mailing list just provide
326 two pieces of information: a repo URL and a branch name; this
328 -is designed to be easily cut&pasted at the end of a 'git fetch'
327 +is designed to be easily cut&pasted at the end of a `git fetch`
328 command line:
329
330 ------------
@@ -403,6 +402,14 @@ FILES
402 user in an editor session will be available in this file, but
403 may be overwritten by the next invocation of `git tag`.
404
405 +CONFIGURATION
406 +-------------
407 +
408 +include::includes/cmd-config-section-all.adoc[]
409 +
410 +:git-tag: 1
411 +include::config/tag.adoc[]
412 +
413 NOTES
414 -----
415