doc: convert git-status to synopsis style

Also convert unformatted lists to proper AsciiDoc lists. 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 Dec 20, 2025 at 19:16 UTC 20e56300d439a7d607de3e824cd98ddaa0f78f2d
1 file changed +95 -87
Documentation/git-status.adoc
+95 -87
@@ -8,8 +8,9 @@ git-status - Show the working tree status
8
9 SYNOPSIS
10 --------
11 -[verse]
12 -'git status' [<options>] [--] [<pathspec>...]
11 +
12 +[synopsis]
13 +git status [<options>] [--] [<pathspec>...]
14
15 DESCRIPTION
16 -----------
@@ -18,57 +19,57 @@ current HEAD commit, paths that have differences between the working
19 tree and the index file, and paths in the working tree that are not
20 tracked by Git (and are not ignored by linkgit:gitignore[5]). The first
21 are what you _would_ commit by running `git commit`; the second and
21 -third are what you _could_ commit by running 'git add' before running
22 +third are what you _could_ commit by running `git add` before running
23 `git commit`.
24
25 OPTIONS
26 -------
27
27 --s::
28 ---short::
28 +`-s`::
29 +`--short`::
30 Give the output in the short-format.
31
31 --b::
32 ---branch::
32 +`-b`::
33 +`--branch`::
34 Show the branch and tracking info even in short-format.
35
35 ---show-stash::
36 +`--show-stash`::
37 Show the number of entries currently stashed away.
38
38 ---porcelain[=<version>]::
39 +`--porcelain[=<version>]`::
40 Give the output in an easy-to-parse format for scripts.
41 This is similar to the short output, but will remain stable
42 across Git versions and regardless of user configuration. See
43 below for details.
44 +
44 -The version parameter is used to specify the format version.
45 -This is optional and defaults to the original version 'v1' format.
45 +The _<version>_ parameter is used to specify the format version.
46 +This is optional and defaults to the original version `v1` format.
47
47 ---long::
48 +`--long`::
49 Give the output in the long-format. This is the default.
50
50 --v::
51 ---verbose::
51 +`-v`::
52 +`--verbose`::
53 In addition to the names of files that have been changed, also
54 show the textual changes that are staged to be committed
55 (i.e., like the output of `git diff --cached`). If `-v` is specified
56 twice, then also show the changes in the working tree that
57 have not yet been staged (i.e., like the output of `git diff`).
58
58 --u[<mode>]::
59 ---untracked-files[=<mode>]::
59 +`-u[<mode>]`::
60 +`--untracked-files[=<mode>]`::
61 Show untracked files.
62 +
63 --
64 The mode parameter is used to specify the handling of untracked files.
64 -It is optional: it defaults to 'all', and if specified, it must be
65 +It is optional: it defaults to `all`, and if specified, it must be
66 stuck to the option (e.g. `-uno`, but not `-u no`).
67
68 The possible options are:
69
69 - - 'no' - Show no untracked files.
70 - - 'normal' - Shows untracked files and directories.
71 - - 'all' - Also shows individual files in untracked directories.
70 +`no`:: Show no untracked files.
71 +`normal`:: Show untracked files and directories.
72 +`all`:: Also show individual files in untracked directories.
73
74 When `-u` option is not used, untracked files and directories are
75 shown (i.e. the same as specifying `normal`), to help you avoid
@@ -82,76 +83,78 @@ return more quickly without showing untracked files.
83 All usual spellings for Boolean value `true` are taken as `normal`
84 and `false` as `no`.
85
85 -The default can be changed using the status.showUntrackedFiles
86 +The default can be changed using the `status.showUntrackedFiles`
87 configuration variable documented in linkgit:git-config[1].
88 --
89
89 ---ignore-submodules[=<when>]::
90 - Ignore changes to submodules when looking for changes. <when> can be
91 - either "none", "untracked", "dirty" or "all", which is the default.
92 - Using "none" will consider the submodule modified when it either contains
90 +`--ignore-submodules[=<when>]`::
91 + Ignore changes to submodules when looking for changes. _<when>_ can be
92 + either `none`, `untracked`, `dirty` or `all`, which is the default.
93 +`none`;; will consider the submodule modified when it either contains
94 untracked or modified files or its HEAD differs from the commit recorded
95 in the superproject and can be used to override any settings of the
95 - 'ignore' option in linkgit:git-config[1] or linkgit:gitmodules[5]. When
96 - "untracked" is used submodules are not considered dirty when they only
96 + `ignore` option in linkgit:git-config[1] or linkgit:gitmodules[5].
97 +`untracked`;; submodules are not considered dirty when they only
98 contain untracked content (but they are still scanned for modified
98 - content). Using "dirty" ignores all changes to the work tree of submodules,
99 + content).
100 +`dirty`;; ignore all changes to the work tree of submodules,
101 only changes to the commits stored in the superproject are shown (this was
100 - the behavior before 1.7.0). Using "all" hides all changes to submodules
102 + the behavior before 1.7.0).
103 +`all`;; hide all changes to submodules
104 (and suppresses the output of submodule summaries when the config option
105 `status.submoduleSummary` is set).
106
104 ---ignored[=<mode>]::
107 +`--ignored[=<mode>]`::
108 Show ignored files as well.
109 +
110 --
111 The mode parameter is used to specify the handling of ignored files.
109 -It is optional: it defaults to 'traditional'.
112 +It is optional: it defaults to `traditional`.
113
114 The possible options are:
115
113 - - 'traditional' - Shows ignored files and directories, unless
114 - --untracked-files=all is specified, in which case
115 - individual files in ignored directories are
116 - displayed.
117 - - 'no' - Show no ignored files.
118 - - 'matching' - Shows ignored files and directories matching an
119 - ignore pattern.
120 -
121 -When 'matching' mode is specified, paths that explicitly match an
116 +`traditional`:: Show ignored files and directories, unless
117 +`--untracked-files=all` is specified, in which case
118 + individual files in ignored directories are
119 + displayed.
120 +`no`:: Show no ignored files.
121 +`matching`:: Show ignored files and directories matching an
122 +ignore pattern.
123 ++
124 +Paths that explicitly match an
125 ignored pattern are shown. If a directory matches an ignore pattern,
126 then it is shown, but not paths contained in the ignored directory. If
127 a directory does not match an ignore pattern, but all contents are
128 ignored, then the directory is not shown, but all contents are shown.
129 --
130
128 --z::
129 - Terminate entries with NUL, instead of LF. This implies
131 +`-z`::
132 + Terminate entries with _NUL_, instead of _LF_. This implies
133 the `--porcelain=v1` output format if no other format is given.
134
132 ---column[=<options>]::
133 ---no-column::
135 +`--column[=<options>]`::
136 +`--no-column`::
137 Display untracked files in columns. See configuration variable
138 `column.status` for option syntax. `--column` and `--no-column`
136 - without options are equivalent to 'always' and 'never'
139 + without options are equivalent to `always` and `never`
140 respectively.
141
139 ---ahead-behind::
140 ---no-ahead-behind::
142 +`--ahead-behind`::
143 +`--no-ahead-behind`::
144 Display or do not display detailed ahead/behind counts for the
142 - branch relative to its upstream branch. Defaults to true.
145 + branch relative to its upstream branch. Defaults to `true`.
146
144 ---renames::
145 ---no-renames::
147 +`--renames`::
148 +`--no-renames`::
149 Turn on/off rename detection regardless of user configuration.
150 See also linkgit:git-diff[1] `--no-renames`.
151
149 ---find-renames[=<n>]::
152 +`--find-renames[=<n>]`::
153 Turn on rename detection, optionally setting the similarity
154 threshold.
155 See also linkgit:git-diff[1] `--find-renames`.
156
154 -<pathspec>...::
157 +`<pathspec>...`::
158 See the 'pathspec' entry in linkgit:gitglossary[7].
159
160 OUTPUT
@@ -173,12 +176,12 @@ Short Format
176 In the short-format, the status of each path is shown as one of these
177 forms
178
176 - XY PATH
177 - XY ORIG_PATH -> PATH
179 + <xy> <path>
180 + <xy> <orig-path> -> <path>
181
179 -where `ORIG_PATH` is where the renamed/copied contents came
180 -from. `ORIG_PATH` is only shown when the entry is renamed or
181 -copied. The `XY` is a two-letter status code.
182 +where _<orig-path>_ is where the renamed/copied contents came
183 +from. _<orig-path>_ is only shown when the entry is renamed or
184 +copied. The _<xy>_ is a two-letter status code `XY`.
185
186 The fields (including the `->`) are separated from each other by a
187 single space. If a filename contains whitespace or other nonprintable
@@ -187,7 +190,7 @@ literal: surrounded by ASCII double quote (34) characters, and with
190 interior special characters backslash-escaped.
191
192 There are three different types of states that are shown using this format, and
190 -each one uses the `XY` syntax differently:
193 +each one uses the _<xy>_ syntax differently:
194
195 * When a merge is occurring and the merge was successful, or outside of a merge
196 situation, `X` shows the status of the index and `Y` shows the status of the
@@ -207,14 +210,14 @@ In the following table, these three classes are shown in separate sections, and
210 these characters are used for `X` and `Y` fields for the first two sections that
211 show tracked paths:
212
210 -* ' ' = unmodified
211 -* 'M' = modified
212 -* 'T' = file type changed (regular file, symbolic link or submodule)
213 -* 'A' = added
214 -* 'D' = deleted
215 -* 'R' = renamed
216 -* 'C' = copied (if config option status.renames is set to "copies")
217 -* 'U' = updated but unmerged
213 +' ':: unmodified
214 +`M`:: modified
215 +`T`:: file type changed (regular file, symbolic link or submodule)
216 +`A`:: added
217 +`D`:: deleted
218 +`R`:: renamed
219 +`C`:: copied (if config option status.renames is set to "copies")
220 +`U`:: updated but unmerged
221
222 ....
223 X Y Meaning
@@ -248,19 +251,21 @@ U U unmerged, both modified
251
252 Submodules have more state and instead report
253
251 -* 'M' = the submodule has a different HEAD than recorded in the index
252 -* 'm' = the submodule has modified content
253 -* '?' = the submodule has untracked files
254 +`M`:: the submodule has a different HEAD than recorded in the index
255 +`m`:: the submodule has modified content
256 +`?`:: the submodule has untracked files
257
258 This is since modified content or untracked files in a submodule cannot be added
259 via `git add` in the superproject to prepare a commit.
260
258 -'m' and '?' are applied recursively. For example if a nested submodule
259 -in a submodule contains an untracked file, this is reported as '?' as well.
261 +`m` and `?` are applied recursively. For example if a nested submodule
262 +in a submodule contains an untracked file, this is reported as `?` as well.
263 +
264 +If `-b` is used the short-format status is preceded by a line
265
261 -If -b is used the short-format status is preceded by a line
266 +[synopsis]
267 +{empty}## <branchname> <tracking-info>
268
263 - ## branchname tracking info
269
270 Porcelain Format Version 1
271 ~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -271,16 +276,16 @@ based on user configuration. This makes it ideal for parsing by scripts.
276 The description of the short format above also describes the porcelain
277 format, with a few exceptions:
278
274 -1. The user's color.status configuration is not respected; color will
279 +1. The user's `color.status` configuration is not respected; color will
280 always be off.
281
277 -2. The user's status.relativePaths configuration is not respected; paths
282 +2. The user's `status.relativePaths` configuration is not respected; paths
283 shown will always be relative to the repository root.
284
280 -There is also an alternate -z format recommended for machine parsing. In
285 +There is also an alternate `-z` format recommended for machine parsing. In
286 that format, the status field is the same, but some other things
282 -change. First, the '\->' is omitted from rename entries and the field
283 -order is reversed (e.g 'from \-> to' becomes 'to from'). Second, a NUL
287 +change. First, the `->` is omitted from rename entries and the field
288 +order is reversed (e.g `from -> to` becomes `to from`). Second, a _NUL_
289 (ASCII 0) follows each filename, replacing space as a field separator
290 and the terminating newline (but a space still separates the status
291 field from the first filename). Third, filenames containing special
@@ -296,7 +301,7 @@ Version 2 format adds more detailed information about the state of
301 the worktree and changed items. Version 2 also defines an extensible
302 set of easy to parse optional headers.
303
299 -Header lines start with "#" and are added in response to specific
304 +Header lines start with `#` and are added in response to specific
305 command line arguments. Parsers should ignore headers they
306 don't recognize.
307
@@ -336,11 +341,13 @@ line types in any order.
341
342 Ordinary changed entries have the following format:
343
339 - 1 <XY> <sub> <mH> <mI> <mW> <hH> <hI> <path>
344 +[synopsis]
345 +1 <XY> <sub> <mH> <mI> <mW> <hH> <hI> <path>
346
347 Renamed or copied entries have the following format:
348
343 - 2 <XY> <sub> <mH> <mI> <mW> <hH> <hI> <X><score> <path><sep><origPath>
349 +[synopsis]
350 +2 <XY> <sub> <mH> <mI> <mW> <hH> <hI> <X><score> <path><sep><origPath>
351
352 ....
353 Field Meaning
@@ -377,7 +384,8 @@ Field Meaning
384 Unmerged entries have the following format; the first character is
385 a "u" to distinguish from ordinary changed entries.
386
380 - u <XY> <sub> <m1> <m2> <m3> <mW> <h1> <h2> <h3> <path>
387 +[synopsis]
388 +u <XY> <sub> <m1> <m2> <m3> <mW> <h1> <h2> <h3> <path>
389
390 ....
391 Field Meaning
@@ -416,7 +424,7 @@ Pathname Format Notes and -z
424 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
425
426 When the `-z` option is given, pathnames are printed as is and
419 -without any quoting and lines are terminated with a NUL (ASCII 0x00)
427 +without any quoting and lines are terminated with a _NUL_ (ASCII 0x00)
428 byte.
429
430 Without the `-z` option, pathnames with "unusual" characters are
@@ -439,11 +447,11 @@ directory.
447 If `status.submoduleSummary` is set to a non zero number or true (identical
448 to -1 or an unlimited number), the submodule summary will be enabled for
449 the long format and a summary of commits for modified submodules will be
442 -shown (see --summary-limit option of linkgit:git-submodule[1]). Please note
450 +shown (see `--summary-limit` option of linkgit:git-submodule[1]). Please note
451 that the summary output from the status command will be suppressed for all
444 -submodules when `diff.ignoreSubmodules` is set to 'all' or only for those
452 +submodules when `diff.ignoreSubmodules` is set to `all` or only for those
453 submodules where `submodule.<name>.ignore=all`. To also view the summary for
446 -ignored submodules you can either use the --ignore-submodules=dirty command
454 +ignored submodules you can either use the `--ignore-submodules=dirty` command
455 line option or the 'git submodule summary' command, which shows a similar
456 output but does not honor these settings.
457
@@ -484,7 +492,7 @@ results, so it could be faster on subsequent runs.
492 setting this variable to `false` disables the warning message
493 given when enumerating untracked files takes more than 2
494 seconds. In a large project, it may take longer and the user
487 - may have already accepted the trade off (e.g. using "-uno" may
495 + may have already accepted the trade off (e.g. using `-uno` may
496 not be an acceptable option for the user), in which case, there
497 is no point issuing the warning message, and in such a case,
498 disabling the warning may be the best.