Skip to content

Commit c62b65c

Browse files
committed
doc: convert git worktree 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 <[email protected]>
1 parent 9d23142 commit c62b65c

File tree

2 files changed

+91
-84
lines changed

2 files changed

+91
-84
lines changed

Documentation/config/worktree.adoc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
worktree.guessRemote::
1+
`worktree.guessRemote`::
22
If no branch is specified and neither `-b` nor `-B` nor
33
`--detach` is used, then `git worktree add` defaults to
44
creating a new branch from HEAD. If `worktree.guessRemote` is
55
set to true, `worktree add` tries to find a remote-tracking
66
branch whose name uniquely matches the new branch name. If
77
such a branch exists, it is checked out and set as "upstream"
88
for the new branch. If no such match can be found, it falls
9-
back to creating a new branch from the current HEAD.
9+
back to creating a new branch from the current `HEAD`.
1010

11-
worktree.useRelativePaths::
12-
Link worktrees using relative paths (when "true") or absolute
13-
paths (when "false"). This is particularly useful for setups
11+
`worktree.useRelativePaths`::
12+
Link worktrees using relative paths (when "`true`") or absolute
13+
paths (when "`false`"). This is particularly useful for setups
1414
where the repository and worktrees may be moved between
15-
different locations or environments. Defaults to "false".
15+
different locations or environments. Defaults to "`false`".
1616
+
17-
Note that setting `worktree.useRelativePaths` to "true" implies enabling the
17+
Note that setting `worktree.useRelativePaths` to "`true`" implies enabling the
1818
`extensions.relativeWorktrees` config (see linkgit:git-config[1]),
1919
thus making it incompatible with older versions of Git.

Documentation/git-worktree.adoc

Lines changed: 84 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ git-worktree - Manage multiple working trees
88

99
SYNOPSIS
1010
--------
11-
[verse]
12-
'git worktree add' [-f] [--detach] [--checkout] [--lock [--reason <string>]]
13-
[--orphan] [(-b | -B) <new-branch>] <path> [<commit-ish>]
14-
'git worktree list' [-v | --porcelain [-z]]
15-
'git worktree lock' [--reason <string>] <worktree>
16-
'git worktree move' <worktree> <new-path>
17-
'git worktree prune' [-n] [-v] [--expire <expire>]
18-
'git worktree remove' [-f] <worktree>
19-
'git worktree repair' [<path>...]
20-
'git worktree unlock' <worktree>
11+
[synopsis]
12+
git worktree add [-f] [--detach] [--checkout] [--lock [--reason <string>]]
13+
[--orphan] [(-b | -B) <new-branch>] <path> [<commit-ish>]
14+
git worktree list [-v | --porcelain [-z]]
15+
git worktree lock [--reason <string>] <worktree>
16+
git worktree move <worktree> <new-path>
17+
git worktree prune [-n] [-v] [--expire <expire>]
18+
git worktree remove [-f] <worktree>
19+
git worktree repair [<path>...]
20+
git worktree unlock <worktree>
2121

2222
DESCRIPTION
2323
-----------
@@ -37,7 +37,7 @@ zero or more linked worktrees. When you are done with a linked worktree,
3737
remove it with `git worktree remove`.
3838

3939
In its simplest form, `git worktree add <path>` automatically creates a
40-
new branch whose name is the final component of `<path>`, which is
40+
new branch whose name is the final component of _<path>_, which is
4141
convenient if you plan to work on a new topic. For instance, `git
4242
worktree add ../hotfix` creates new branch `hotfix` and checks it out at
4343
path `../hotfix`. To instead work on an existing branch in a new worktree,
@@ -63,16 +63,16 @@ locked.
6363

6464
COMMANDS
6565
--------
66-
add <path> [<commit-ish>]::
66+
`add <path> [<commit-ish>]`::
6767

68-
Create a worktree at `<path>` and checkout `<commit-ish>` into it. The new worktree
68+
Create a worktree at _<path>_ and checkout _<commit-ish>_ into it. The new worktree
6969
is linked to the current repository, sharing everything except per-worktree
70-
files such as `HEAD`, `index`, etc. As a convenience, `<commit-ish>` may
70+
files such as `HEAD`, `index`, etc. As a convenience, _<commit-ish>_ may
7171
be a bare "`-`", which is synonymous with `@{-1}`.
7272
+
73-
If `<commit-ish>` is a branch name (call it `<branch>`) and is not found,
73+
If _<commit-ish>_ is a branch name (call it _<branch>_) and is not found,
7474
and neither `-b` nor `-B` nor `--detach` are used, but there does
75-
exist a tracking branch in exactly one remote (call it `<remote>`)
75+
exist a tracking branch in exactly one remote (call it _<remote>_)
7676
with a matching name, treat as equivalent to:
7777
+
7878
------------
@@ -81,32 +81,32 @@ $ git worktree add --track -b <branch> <path> <remote>/<branch>
8181
+
8282
If the branch exists in multiple remotes and one of them is named by
8383
the `checkout.defaultRemote` configuration variable, we'll use that
84-
one for the purposes of disambiguation, even if the `<branch>` isn't
84+
one for the purposes of disambiguation, even if the _<branch>_ isn't
8585
unique across all remotes. Set it to
8686
e.g. `checkout.defaultRemote=origin` to always checkout remote
87-
branches from there if `<branch>` is ambiguous but exists on the
87+
branches from there if _<branch>_ is ambiguous but exists on the
8888
`origin` remote. See also `checkout.defaultRemote` in
8989
linkgit:git-config[1].
9090
+
91-
If `<commit-ish>` is omitted and neither `-b` nor `-B` nor `--detach` used,
91+
If _<commit-ish>_ is omitted and neither `-b` nor `-B` nor `--detach` used,
9292
then, as a convenience, the new worktree is associated with a branch (call
93-
it `<branch>`) named after `$(basename <path>)`. If `<branch>` doesn't
93+
it _<branch>_) named after `$(basename <path>)`. If _<branch>_ doesn't
9494
exist, a new branch based on `HEAD` is automatically created as if
95-
`-b <branch>` was given. If `<branch>` does exist, it will be checked out
95+
`-b <branch>` was given. If _<branch>_ does exist, it will be checked out
9696
in the new worktree, if it's not checked out anywhere else, otherwise the
9797
command will refuse to create the worktree (unless `--force` is used).
9898
+
99-
If `<commit-ish>` is omitted, neither `--detach`, or `--orphan` is
99+
If _<commit-ish>_ is omitted, neither `--detach`, or `--orphan` is
100100
used, and there are no valid local branches (or remote branches if
101101
`--guess-remote` is specified) then, as a convenience, the new worktree is
102-
associated with a new unborn branch named `<branch>` (after
102+
associated with a new unborn branch named _<branch>_ (after
103103
`$(basename <path>)` if neither `-b` or `-B` is used) as if `--orphan` was
104104
passed to the command. In the event the repository has a remote and
105105
`--guess-remote` is used, but no remote or local branches exist, then the
106106
command fails with a warning reminding the user to fetch from their remote
107107
first (or override by using `-f/--force`).
108108

109-
list::
109+
`list`::
110110

111111
List details of each worktree. The main worktree is listed first,
112112
followed by each of the linked worktrees. The output details include
@@ -115,32 +115,32 @@ branch currently checked out (or "detached HEAD" if none), "locked" if
115115
the worktree is locked, "prunable" if the worktree can be pruned by the
116116
`prune` command.
117117

118-
lock::
118+
`lock`::
119119

120120
If a worktree is on a portable device or network share which is not always
121121
mounted, lock it to prevent its administrative files from being pruned
122122
automatically. This also prevents it from being moved or deleted.
123123
Optionally, specify a reason for the lock with `--reason`.
124124

125-
move::
125+
`move`::
126126

127127
Move a worktree to a new location. Note that the main worktree or linked
128128
worktrees containing submodules cannot be moved with this command. (The
129129
`git worktree repair` command, however, can reestablish the connection
130130
with linked worktrees if you move the main worktree manually.)
131131

132-
prune::
132+
`prune`::
133133

134134
Prune worktree information in `$GIT_DIR/worktrees`.
135135

136-
remove::
136+
`remove`::
137137

138138
Remove a worktree. Only clean worktrees (no untracked files and no
139139
modification in tracked files) can be removed. Unclean worktrees or ones
140140
with submodules can be removed with `--force`. The main worktree cannot be
141141
removed.
142142

143-
repair [<path>...]::
143+
`repair [<path>...]`::
144144

145145
Repair worktree administrative files, if possible, if they have become
146146
corrupted or outdated due to external factors.
@@ -154,133 +154,133 @@ Similarly, if the working tree for a linked worktree is moved without
154154
using `git worktree move`, the main worktree (or bare repository) will be
155155
unable to locate it. Running `repair` within the recently-moved worktree
156156
will reestablish the connection. If multiple linked worktrees are moved,
157-
running `repair` from any worktree with each tree's new `<path>` as an
157+
running `repair` from any worktree with each tree's new _<path>_ as an
158158
argument, will reestablish the connection to all the specified paths.
159159
+
160160
If both the main worktree and linked worktrees have been moved or copied manually,
161-
then running `repair` in the main worktree and specifying the new `<path>`
161+
then running `repair` in the main worktree and specifying the new _<path>_
162162
of each linked worktree will reestablish all connections in both
163163
directions.
164164

165-
unlock::
165+
`unlock`::
166166

167167
Unlock a worktree, allowing it to be pruned, moved or deleted.
168168

169169
OPTIONS
170170
-------
171171

172-
-f::
173-
--force::
172+
`-f`::
173+
`--force`::
174174
By default, `add` refuses to create a new worktree when
175-
`<commit-ish>` is a branch name and is already checked out by
176-
another worktree, or if `<path>` is already assigned to some
177-
worktree but is missing (for instance, if `<path>` was deleted
175+
_<commit-ish>_ is a branch name and is already checked out by
176+
another worktree, or if _<path>_ is already assigned to some
177+
worktree but is missing (for instance, if _<path>_ was deleted
178178
manually). This option overrides these safeguards. To add a missing but
179179
locked worktree path, specify `--force` twice.
180180
+
181181
`move` refuses to move a locked worktree unless `--force` is specified
182182
twice. If the destination is already assigned to some other worktree but is
183-
missing (for instance, if `<new-path>` was deleted manually), then `--force`
183+
missing (for instance, if _<new-path>_ was deleted manually), then `--force`
184184
allows the move to proceed; use `--force` twice if the destination is locked.
185185
+
186186
`remove` refuses to remove an unclean worktree unless `--force` is used.
187187
To remove a locked worktree, specify `--force` twice.
188188

189-
-b <new-branch>::
190-
-B <new-branch>::
191-
With `add`, create a new branch named `<new-branch>` starting at
192-
`<commit-ish>`, and check out `<new-branch>` into the new worktree.
193-
If `<commit-ish>` is omitted, it defaults to `HEAD`.
189+
`-b <new-branch>`::
190+
`-B <new-branch>`::
191+
With `add`, create a new branch named _<new-branch>_ starting at
192+
_<commit-ish>_, and check out _<new-branch>_ into the new worktree.
193+
If _<commit-ish>_ is omitted, it defaults to `HEAD`.
194194
By default, `-b` refuses to create a new branch if it already
195-
exists. `-B` overrides this safeguard, resetting `<new-branch>` to
196-
`<commit-ish>`.
195+
exists. `-B` overrides this safeguard, resetting _<new-branch>_ to
196+
_<commit-ish>_.
197197

198-
-d::
199-
--detach::
198+
`-d`::
199+
`--detach`::
200200
With `add`, detach `HEAD` in the new worktree. See "DETACHED HEAD"
201201
in linkgit:git-checkout[1].
202202

203-
--checkout::
204-
--no-checkout::
205-
By default, `add` checks out `<commit-ish>`, however, `--no-checkout` can
203+
`--checkout`::
204+
`--no-checkout`::
205+
By default, `add` checks out _<commit-ish>_, however, `--no-checkout` can
206206
be used to suppress checkout in order to make customizations,
207207
such as configuring sparse-checkout. See "Sparse checkout"
208208
in linkgit:git-read-tree[1].
209209

210-
--guess-remote::
211-
--no-guess-remote::
212-
With `worktree add <path>`, without `<commit-ish>`, instead
210+
`--guess-remote`::
211+
`--no-guess-remote`::
212+
With `worktree add <path>`, without _<commit-ish>_, instead
213213
of creating a new branch from `HEAD`, if there exists a tracking
214-
branch in exactly one remote matching the basename of `<path>`,
214+
branch in exactly one remote matching the basename of _<path>_,
215215
base the new branch on the remote-tracking branch, and mark
216216
the remote-tracking branch as "upstream" from the new branch.
217217
+
218218
This can also be set up as the default behaviour by using the
219219
`worktree.guessRemote` config option.
220220

221-
--relative-paths::
222-
--no-relative-paths::
221+
`--relative-paths`::
222+
`--no-relative-paths`::
223223
Link worktrees using relative paths or absolute paths (default).
224224
Overrides the `worktree.useRelativePaths` config option, see
225225
linkgit:git-config[1].
226226
+
227227
With `repair`, the linking files will be updated if there's an absolute/relative
228228
mismatch, even if the links are correct.
229229

230-
--track::
231-
--no-track::
232-
When creating a new branch, if `<commit-ish>` is a branch,
230+
`--track`::
231+
`--no-track`::
232+
When creating a new branch, if _<commit-ish>_ is a branch,
233233
mark it as "upstream" from the new branch. This is the
234-
default if `<commit-ish>` is a remote-tracking branch. See
234+
default if _<commit-ish>_ is a remote-tracking branch. See
235235
`--track` in linkgit:git-branch[1] for details.
236236

237-
--lock::
237+
`--lock`::
238238
Keep the worktree locked after creation. This is the
239239
equivalent of `git worktree lock` after `git worktree add`,
240240
but without a race condition.
241241

242-
-n::
243-
--dry-run::
242+
`-n`::
243+
`--dry-run`::
244244
With `prune`, do not remove anything; just report what it would
245245
remove.
246246

247-
--orphan::
247+
`--orphan`::
248248
With `add`, make the new worktree and index empty, associating
249-
the worktree with a new unborn branch named `<new-branch>`.
249+
the worktree with a new unborn branch named _<new-branch>_.
250250

251-
--porcelain::
251+
`--porcelain`::
252252
With `list`, output in an easy-to-parse format for scripts.
253253
This format will remain stable across Git versions and regardless of user
254254
configuration. It is recommended to combine this with `-z`.
255255
See below for details.
256256

257-
-z::
258-
Terminate each line with a NUL rather than a newline when
257+
`-z`::
258+
Terminate each line with a _NUL_ rather than a newline when
259259
`--porcelain` is specified with `list`. This makes it possible
260260
to parse the output when a worktree path contains a newline
261261
character.
262262

263-
-q::
264-
--quiet::
263+
`-q`::
264+
`--quiet`::
265265
With `add`, suppress feedback messages.
266266

267-
-v::
268-
--verbose::
267+
`-v`::
268+
`--verbose`::
269269
With `prune`, report all removals.
270270
+
271271
With `list`, output additional information about worktrees (see below).
272272

273-
--expire <time>::
274-
With `prune`, only expire unused worktrees older than `<time>`.
273+
`--expire <time>`::
274+
With `prune`, only expire unused worktrees older than _<time>_.
275275
+
276276
With `list`, annotate missing worktrees as prunable if they are older than
277-
`<time>`.
277+
_<time>_.
278278

279-
--reason <string>::
279+
`--reason <string>`::
280280
With `lock` or with `add --lock`, an explanation why the worktree
281281
is locked.
282282

283-
<worktree>::
283+
_<worktree>_::
284284
Worktrees can be identified by path, either relative or absolute.
285285
+
286286
If the last path components in the worktree's path is unique among
@@ -522,6 +522,13 @@ $ popd
522522
$ git worktree remove ../temp
523523
------------
524524
525+
CONFIGURATION
526+
-------------
527+
528+
include::includes/cmd-config-section-all.adoc[]
529+
530+
include::config/worktree.adoc[]
531+
525532
BUGS
526533
----
527534
Multiple checkout in general is still experimental, and the support

0 commit comments

Comments
 (0)