Skip to content

Commit 3f3e5a8

Browse files
committed
doc: convert git-stash.adoc to synopis 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 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 <[email protected]>
1 parent 5099f64 commit 3f3e5a8

File tree

2 files changed

+85
-78
lines changed

2 files changed

+85
-78
lines changed

Documentation/config/stash.adoc

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
1-
stash.index::
1+
ifndef::git-stash[]
2+
:see-show: See the description of the 'show' command in linkgit:git-stash[1].
3+
endif::git-stash[]
4+
5+
ifdef::git-stash[]
6+
:see-show:
7+
endif::git-stash[]
8+
9+
`stash.index`::
210
If this is set to true, `git stash apply` and `git stash pop` will
3-
behave as if `--index` was supplied. Defaults to false. See the
4-
descriptions in linkgit:git-stash[1].
11+
behave as if `--index` was supplied. Defaults to false.
12+
ifndef::git-stash[]
13+
See the descriptions in linkgit:git-stash[1].
14+
endif::git-stash[]
515

6-
stash.showIncludeUntracked::
16+
`stash.showIncludeUntracked`::
717
If this is set to true, the `git stash show` command will show
8-
the untracked files of a stash entry. Defaults to false. See
9-
the description of the 'show' command in linkgit:git-stash[1].
18+
the untracked files of a stash entry. Defaults to false. {see-show}
1019

11-
stash.showPatch::
20+
`stash.showPatch`::
1221
If this is set to true, the `git stash show` command without an
1322
option will show the stash entry in patch form. Defaults to false.
14-
See the description of the 'show' command in linkgit:git-stash[1].
23+
{see-show}
1524

16-
stash.showStat::
25+
`stash.showStat`::
1726
If this is set to true, the `git stash show` command without an
1827
option will show a diffstat of the stash entry. Defaults to true.
19-
See the description of the 'show' command in linkgit:git-stash[1].
28+
{see-show}

Documentation/git-stash.adoc

Lines changed: 66 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,24 @@ git-stash - Stash the changes in a dirty working directory away
77

88
SYNOPSIS
99
--------
10-
[verse]
11-
'git stash' list [<log-options>]
12-
'git stash' show [-u | --include-untracked | --only-untracked] [<diff-options>] [<stash>]
13-
'git stash' drop [-q | --quiet] [<stash>]
14-
'git stash' pop [--index] [-q | --quiet] [<stash>]
15-
'git stash' apply [--index] [-q | --quiet] [<stash>]
16-
'git stash' branch <branchname> [<stash>]
17-
'git stash' [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]
10+
[synopsis]
11+
git stash list [<log-options>]
12+
git stash show [-u | --include-untracked | --only-untracked] [<diff-options>] [<stash>]
13+
git stash drop [-q | --quiet] [<stash>]
14+
git stash pop [--index] [-q | --quiet] [<stash>]
15+
git stash apply [--index] [-q | --quiet] [<stash>]
16+
git stash branch <branchname> [<stash>]
17+
git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]
1818
[-u | --include-untracked] [-a | --all] [(-m | --message) <message>]
1919
[--pathspec-from-file=<file> [--pathspec-file-nul]]
2020
[--] [<pathspec>...]]
21-
'git stash' save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]
22-
[-u | --include-untracked] [-a | --all] [<message>]
23-
'git stash' clear
24-
'git stash' create [<message>]
25-
'git stash' store [(-m | --message) <message>] [-q | --quiet] <commit>
26-
'git stash' export (--print | --to-ref <ref>) [<stash>...]
27-
'git stash' import <commit>
21+
git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]
22+
[-u | --include-untracked] [-a | --all] [<message>]
23+
git stash clear
24+
git stash create [<message>]
25+
git stash store [(-m | --message) <message>] [-q | --quiet] <commit>
26+
git stash export (--print | --to-ref <ref>) [<stash>...]
27+
git stash import <commit>
2828

2929
DESCRIPTION
3030
-----------
@@ -38,7 +38,7 @@ The modifications stashed away by this command can be listed with
3838
`git stash list`, inspected with `git stash show`, and restored
3939
(potentially on top of a different commit) with `git stash apply`.
4040
Calling `git stash` without any arguments is equivalent to `git stash push`.
41-
A stash is by default listed as "WIP on 'branchname' ...", but
41+
A stash is by default listed as "WIP on '<branchname>' ...", but
4242
you can give a more descriptive message on the command line when
4343
you create one.
4444

@@ -47,16 +47,16 @@ stashes are found in the reflog of this reference and can be named using
4747
the usual reflog syntax (e.g. `stash@{0}` is the most recently
4848
created stash, `stash@{1}` is the one before it, `stash@{2.hours.ago}`
4949
is also possible). Stashes may also be referenced by specifying just the
50-
stash index (e.g. the integer `n` is equivalent to `stash@{n}`).
50+
stash index (e.g. the integer `<n>` is equivalent to `stash@{<n>}`).
5151

5252
COMMANDS
5353
--------
5454

55-
push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q|--quiet] [(-m|--message) <message>] [--pathspec-from-file=<file> [--pathspec-file-nul]] [--] [<pathspec>...]::
55+
`push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-u | --include-untracked] [ -a | --all] [-q | --quiet] [(-m|--message) <message>] [--pathspec-from-file=<file> [--pathspec-file-nul]] [--] [<pathspec>...]`::
5656

5757
Save your local modifications to a new 'stash entry' and roll them
58-
back to HEAD (in the working tree and in the index).
59-
The <message> part is optional and gives
58+
back to `HEAD` (in the working tree and in the index).
59+
The _<message>_ part is optional and gives
6060
the description along with the stashed state.
6161
+
6262
For quickly making a snapshot, you can omit "push". In this mode,
@@ -65,14 +65,14 @@ subcommand from making an unwanted stash entry. The two exceptions to this
6565
are `stash -p` which acts as alias for `stash push -p` and pathspec elements,
6666
which are allowed after a double hyphen `--` for disambiguation.
6767

68-
save [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q|--quiet] [<message>]::
68+
`save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-u | --include-untracked] [-a | --all] [-q | --quiet] [<message>]`::
6969

7070
This option is deprecated in favour of 'git stash push'. It
7171
differs from "stash push" in that it cannot take pathspec.
7272
Instead, all non-option arguments are concatenated to form the stash
7373
message.
7474

75-
list [<log-options>]::
75+
`list [<log-options>]`::
7676

7777
List the stash entries that you currently have. Each 'stash entry' is
7878
listed with its name (e.g. `stash@{0}` is the latest entry, `stash@{1}` is
@@ -88,20 +88,20 @@ stash@{1}: On master: 9cc0589... Add git-stash
8888
The command takes options applicable to the 'git log'
8989
command to control what is shown and how. See linkgit:git-log[1].
9090

91-
show [-u|--include-untracked|--only-untracked] [<diff-options>] [<stash>]::
91+
`show [-u | --include-untracked | --only-untracked] [<diff-options>] [<stash>]`::
9292

9393
Show the changes recorded in the stash entry as a diff between the
9494
stashed contents and the commit back when the stash entry was first
9595
created.
9696
By default, the command shows the diffstat, but it will accept any
9797
format known to 'git diff' (e.g., `git stash show -p stash@{1}`
9898
to view the second most recent entry in patch form).
99-
If no `<diff-option>` is provided, the default behavior will be given
99+
If no _<diff-option>_ is provided, the default behavior will be given
100100
by the `stash.showStat`, and `stash.showPatch` config variables. You
101101
can also use `stash.showIncludeUntracked` to set whether
102102
`--include-untracked` is enabled by default.
103103

104-
pop [--index] [-q|--quiet] [<stash>]::
104+
`pop [--index] [-q | --quiet] [<stash>]`::
105105

106106
Remove a single stashed state from the stash list and apply it
107107
on top of the current working tree state, i.e., do the inverse
@@ -112,103 +112,100 @@ Applying the state can fail with conflicts; in this case, it is not
112112
removed from the stash list. You need to resolve the conflicts by hand
113113
and call `git stash drop` manually afterwards.
114114

115-
apply [--index] [-q|--quiet] [<stash>]::
115+
`apply [--index] [-q | --quiet] [<stash>]`::
116116

117117
Like `pop`, but do not remove the state from the stash list. Unlike `pop`,
118118
`<stash>` may be any commit that looks like a commit created by
119119
`stash push` or `stash create`.
120120

121-
branch <branchname> [<stash>]::
121+
`branch <branchname> [<stash>]`::
122122

123-
Creates and checks out a new branch named `<branchname>` starting from
124-
the commit at which the `<stash>` was originally created, applies the
125-
changes recorded in `<stash>` to the new working tree and index.
126-
If that succeeds, and `<stash>` is a reference of the form
127-
`stash@{<revision>}`, it then drops the `<stash>`.
123+
Creates and checks out a new branch named _<branchname>_ starting from
124+
the commit at which the _<stash>_ was originally created, applies the
125+
changes recorded in _<stash>_ to the new working tree and index.
126+
If that succeeds, and _<stash>_ is a reference of the form
127+
`stash@{<revision>}`, it then drops the _<stash>_.
128128
+
129129
This is useful if the branch on which you ran `git stash push` has
130130
changed enough that `git stash apply` fails due to conflicts. Since
131131
the stash entry is applied on top of the commit that was HEAD at the
132132
time `git stash` was run, it restores the originally stashed state
133133
with no conflicts.
134134

135-
clear::
135+
`clear`::
136136
Remove all the stash entries. Note that those entries will then
137137
be subject to pruning, and may be impossible to recover (see
138-
'Examples' below for a possible strategy).
139-
140-
drop [-q|--quiet] [<stash>]::
138+
'EXAMPLES' below for a possible strategy).
141139

140+
`drop [-q | --quiet] [<stash>]`::
142141
Remove a single stash entry from the list of stash entries.
143142

144-
create::
145-
143+
`create`::
146144
Create a stash entry (which is a regular commit object) and
147145
return its object name, without storing it anywhere in the ref
148146
namespace.
149147
This is intended to be useful for scripts. It is probably not
150148
the command you want to use; see "push" above.
151149

152-
store::
150+
`store`::
153151

154152
Store a given stash created via 'git stash create' (which is a
155153
dangling merge commit) in the stash ref, updating the stash
156154
reflog. This is intended to be useful for scripts. It is
157155
probably not the command you want to use; see "push" above.
158156

159-
export ( --print | --to-ref <ref> ) [<stash>...]::
157+
`export ( --print | --to-ref <ref> ) [<stash>...]`::
160158

161159
Export the specified stashes, or all of them if none are specified, to
162160
a chain of commits which can be transferred using the normal fetch and
163161
push mechanisms, then imported using the `import` subcommand.
164162

165-
import <commit>::
166-
163+
`import <commit>`::
167164
Import the specified stashes from the specified commit, which must have been
168165
created by `export`, and add them to the list of stashes. To replace the
169166
existing stashes, use `clear` first.
170167

171168
OPTIONS
172169
-------
173-
-a::
174-
--all::
170+
`-a`::
171+
`--all`::
175172
This option is only valid for `push` and `save` commands.
176173
+
177174
All ignored and untracked files are also stashed and then cleaned
178175
up with `git clean`.
179176
180-
-u::
181-
--include-untracked::
182-
--no-include-untracked::
177+
`-u`::
178+
`--include-untracked`::
179+
`--no-include-untracked`::
183180
When used with the `push` and `save` commands,
184181
all untracked files are also stashed and then cleaned up with
185182
`git clean`.
186183
+
187184
When used with the `show` command, show the untracked files in the stash
188185
entry as part of the diff.
189186
190-
--only-untracked::
187+
`--only-untracked`::
191188
This option is only valid for the `show` command.
192189
+
193190
Show only the untracked files in the stash entry as part of the diff.
194191
195-
--index::
192+
`--index`::
196193
This option is only valid for `pop` and `apply` commands.
197194
+
198195
Tries to reinstate not only the working tree's changes, but also
199196
the index's ones. However, this can fail, when you have conflicts
200197
(which are stored in the index, where you therefore can no longer
201198
apply the changes as they were originally).
202199
203-
-k::
204-
--keep-index::
205-
--no-keep-index::
200+
`-k`::
201+
`--keep-index`::
202+
`--no-keep-index`::
206203
This option is only valid for `push` and `save` commands.
207204
+
208205
All changes already added to the index are left intact.
209206
210-
-p::
211-
--patch::
207+
`-p`::
208+
`--patch`::
212209
This option is only valid for `push` and `save` commands.
213210
+
214211
Interactively select hunks from the diff between HEAD and the
@@ -224,8 +221,8 @@ The `--patch` option implies `--keep-index`. You can use
224221
225222
include::diff-context-options.adoc[]
226223
227-
-S::
228-
--staged::
224+
`-S`::
225+
`--staged`::
229226
This option is only valid for `push` and `save` commands.
230227
+
231228
Stash only the changes that are currently staged. This is similar to
@@ -234,49 +231,49 @@ of current branch.
234231
+
235232
The `--patch` option has priority over this one.
236233
237-
--pathspec-from-file=<file>::
234+
`--pathspec-from-file=<file>`::
238235
This option is only valid for `push` command.
239236
+
240-
Pathspec is passed in `<file>` instead of commandline args. If
241-
`<file>` is exactly `-` then standard input is used. Pathspec
237+
Pathspec is passed in _<file>_ instead of commandline args. If
238+
_<file>_ is exactly `-` then standard input is used. Pathspec
242239
elements are separated by LF or CR/LF. Pathspec elements can be
243240
quoted as explained for the configuration variable `core.quotePath`
244241
(see linkgit:git-config[1]). See also `--pathspec-file-nul` and
245242
global `--literal-pathspecs`.
246243
247-
--pathspec-file-nul::
244+
`--pathspec-file-nul`::
248245
This option is only valid for `push` command.
249246
+
250247
Only meaningful with `--pathspec-from-file`. Pathspec elements are
251248
separated with NUL character and all other characters are taken
252249
literally (including newlines and quotes).
253250
254-
-q::
255-
--quiet::
251+
`-q`::
252+
`--quiet`::
256253
This option is only valid for `apply`, `drop`, `pop`, `push`,
257254
`save`, `store` commands.
258255
+
259256
Quiet, suppress feedback messages.
260257
261-
--print::
258+
`--print`::
262259
This option is only valid for the `export` command.
263260
+
264261
Create the chain of commits representing the exported stashes without
265262
storing it anywhere in the ref namespace and print the object ID to
266263
standard output. This is designed for scripts.
267264
268-
--to-ref::
265+
`--to-ref`::
269266
This option is only valid for the `export` command.
270267
+
271268
Create the chain of commits representing the exported stashes and store
272269
it to the specified ref.
273270
274-
\--::
271+
`--`::
275272
This option is only valid for `push` command.
276273
+
277274
Separates pathspec from options for disambiguation purposes.
278275
279-
<pathspec>...::
276+
`<pathspec>...`::
280277
This option is only valid for `push` command.
281278
+
282279
The new stash entry records the modified states only for the files
@@ -286,11 +283,11 @@ too, leaving files that do not match the pathspec intact.
286283
+
287284
For more details, see the 'pathspec' entry in linkgit:gitglossary[7].
288285
289-
<stash>::
286+
_<stash>_::
290287
This option is only valid for `apply`, `branch`, `drop`, `pop`,
291288
`show`, and `export` commands.
292289
+
293-
A reference of the form `stash@{<revision>}`. When no `<stash>` is
290+
A reference of the form `stash@{<revision>}`. When no _<stash>_ is
294291
given, the latest stash is assumed (that is, `stash@{0}`).
295292
296293
DISCUSSION
@@ -419,6 +416,7 @@ CONFIGURATION
419416

420417
include::includes/cmd-config-section-all.adoc[]
421418

419+
:git-stash: 1
422420
include::config/stash.adoc[]
423421

424422

0 commit comments

Comments
 (0)