Skip to content

Commit 5d2fc91

Browse files
peffgitster
authored andcommitted
docs: put listed example commands in backticks
Many examples of git command invocation are given in asciidoc listing blocks, which makes them monospaced and avoids further interpretation of special characters. Some manpages make a list of examples, like: git foo:: Run git foo. git foo -q:: Use the "-q" option. to quickly show many variants. However, they can sometimes be hard to read, because they are shown in a proportional-width font (so, for example, seeing the difference between "-- foo" and "--foo" can be difficult). This patch puts all such examples into backticks, which gives the equivalent formatting to a listing block (i.e., monospaced and without character interpretation). As a bonus, this also fixes an example in the git-push manpage, in which "git push origin :::" was accidentally considered a newly-indented list, and not a list item with "git push origin :" in it. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 927cd1f commit 5d2fc91

13 files changed

+66
-66
lines changed

Documentation/git-archive.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,41 +142,41 @@ while archiving any tree in your `$GIT_DIR/info/attributes` file.
142142

143143
EXAMPLES
144144
--------
145-
git archive --format=tar --prefix=junk/ HEAD | (cd /var/tmp/ && tar xf -)::
145+
`git archive --format=tar --prefix=junk/ HEAD | (cd /var/tmp/ && tar xf -)`::
146146

147147
Create a tar archive that contains the contents of the
148148
latest commit on the current branch, and extract it in the
149149
`/var/tmp/junk` directory.
150150

151-
git archive --format=tar --prefix=git-1.4.0/ v1.4.0 | gzip >git-1.4.0.tar.gz::
151+
`git archive --format=tar --prefix=git-1.4.0/ v1.4.0 | gzip >git-1.4.0.tar.gz`::
152152

153153
Create a compressed tarball for v1.4.0 release.
154154

155-
git archive --format=tar.gz --prefix=git-1.4.0/ v1.4.0 >git-1.4.0.tar.gz::
155+
`git archive --format=tar.gz --prefix=git-1.4.0/ v1.4.0 >git-1.4.0.tar.gz`::
156156

157157
Same as above, but using the builtin tar.gz handling.
158158

159-
git archive --prefix=git-1.4.0/ -o git-1.4.0.tar.gz v1.4.0::
159+
`git archive --prefix=git-1.4.0/ -o git-1.4.0.tar.gz v1.4.0`::
160160

161161
Same as above, but the format is inferred from the output file.
162162

163-
git archive --format=tar --prefix=git-1.4.0/ v1.4.0{caret}\{tree\} | gzip >git-1.4.0.tar.gz::
163+
`git archive --format=tar --prefix=git-1.4.0/ v1.4.0{caret}\{tree\} | gzip >git-1.4.0.tar.gz`::
164164

165165
Create a compressed tarball for v1.4.0 release, but without a
166166
global extended pax header.
167167

168-
git archive --format=zip --prefix=git-docs/ HEAD:Documentation/ > git-1.4.0-docs.zip::
168+
`git archive --format=zip --prefix=git-docs/ HEAD:Documentation/ > git-1.4.0-docs.zip`::
169169

170170
Put everything in the current head's Documentation/ directory
171171
into 'git-1.4.0-docs.zip', with the prefix 'git-docs/'.
172172

173-
git archive -o latest.zip HEAD::
173+
`git archive -o latest.zip HEAD`::
174174

175175
Create a Zip archive that contains the contents of the latest
176176
commit on the current branch. Note that the output format is
177177
inferred by the extension of the output file.
178178

179-
git config tar.tar.xz.command "xz -c"::
179+
`git config tar.tar.xz.command "xz -c"`::
180180

181181
Configure a "tar.xz" format for making LZMA-compressed tarfiles.
182182
You can use it specifying `--format=tar.xz`, or by creating an

Documentation/git-cherry-pick.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,39 +112,39 @@ effect to your index in a row.
112112

113113
EXAMPLES
114114
--------
115-
git cherry-pick master::
115+
`git cherry-pick master`::
116116

117117
Apply the change introduced by the commit at the tip of the
118118
master branch and create a new commit with this change.
119119

120-
git cherry-pick ..master::
121-
git cherry-pick ^HEAD master::
120+
`git cherry-pick ..master`::
121+
`git cherry-pick ^HEAD master`::
122122

123123
Apply the changes introduced by all commits that are ancestors
124124
of master but not of HEAD to produce new commits.
125125

126-
git cherry-pick master{tilde}4 master{tilde}2::
126+
`git cherry-pick master{tilde}4 master{tilde}2`::
127127

128128
Apply the changes introduced by the fifth and third last
129129
commits pointed to by master and create 2 new commits with
130130
these changes.
131131

132-
git cherry-pick -n master~1 next::
132+
`git cherry-pick -n master~1 next`::
133133

134134
Apply to the working tree and the index the changes introduced
135135
by the second last commit pointed to by master and by the last
136136
commit pointed to by next, but do not create any commit with
137137
these changes.
138138

139-
git cherry-pick --ff ..next::
139+
`git cherry-pick --ff ..next`::
140140

141141
If history is linear and HEAD is an ancestor of next, update
142142
the working tree and advance the HEAD pointer to match next.
143143
Otherwise, apply the changes introduced by those commits that
144144
are in next but not HEAD to the current branch, creating a new
145145
commit for each new change.
146146

147-
git rev-list --reverse master \-- README | git cherry-pick -n --stdin::
147+
`git rev-list --reverse master \-- README | git cherry-pick -n --stdin`::
148148

149149
Apply the changes introduced by all commits on the master
150150
branch that touched README to the working tree and index,

Documentation/git-grep.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,15 +215,15 @@ OPTIONS
215215
Examples
216216
--------
217217

218-
git grep {apostrophe}time_t{apostrophe} \-- {apostrophe}*.[ch]{apostrophe}::
218+
`git grep {apostrophe}time_t{apostrophe} \-- {apostrophe}*.[ch]{apostrophe}`::
219219
Looks for `time_t` in all tracked .c and .h files in the working
220220
directory and its subdirectories.
221221

222-
git grep -e {apostrophe}#define{apostrophe} --and \( -e MAX_PATH -e PATH_MAX \)::
222+
`git grep -e {apostrophe}#define{apostrophe} --and \( -e MAX_PATH -e PATH_MAX \)`::
223223
Looks for a line that has `#define` and either `MAX_PATH` or
224224
`PATH_MAX`.
225225

226-
git grep --all-match -e NODE -e Unexpected::
226+
`git grep --all-match -e NODE -e Unexpected`::
227227
Looks for a line that has `NODE` or `Unexpected` in
228228
files that have lines that match both.
229229

Documentation/git-gui.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ version::
5050

5151
Examples
5252
--------
53-
git gui blame Makefile::
53+
`git gui blame Makefile`::
5454

5555
Show the contents of the file 'Makefile' in the current
5656
working directory, and provide annotations for both the
@@ -59,41 +59,41 @@ git gui blame Makefile::
5959
uncommitted changes (if any) are explicitly attributed to
6060
'Not Yet Committed'.
6161

62-
git gui blame v0.99.8 Makefile::
62+
`git gui blame v0.99.8 Makefile`::
6363

6464
Show the contents of 'Makefile' in revision 'v0.99.8'
6565
and provide annotations for each line. Unlike the above
6666
example the file is read from the object database and not
6767
the working directory.
6868

69-
git gui blame --line=100 Makefile::
69+
`git gui blame --line=100 Makefile`::
7070

7171
Loads annotations as described above and automatically
7272
scrolls the view to center on line '100'.
7373

74-
git gui citool::
74+
`git gui citool`::
7575

7676
Make one commit and return to the shell when it is complete.
7777
This command returns a non-zero exit code if the window was
7878
closed in any way other than by making a commit.
7979

80-
git gui citool --amend::
80+
`git gui citool --amend`::
8181

8282
Automatically enter the 'Amend Last Commit' mode of
8383
the interface.
8484

85-
git gui citool --nocommit::
85+
`git gui citool --nocommit`::
8686

8787
Behave as normal citool, but instead of making a commit
8888
simply terminate with a zero exit code. It still checks
8989
that the index does not contain any unmerged entries, so
9090
you can use it as a GUI version of linkgit:git-mergetool[1]
9191

92-
git citool::
92+
`git citool`::
9393

9494
Same as `git gui citool` (above).
9595

96-
git gui browser maint::
96+
`git gui browser maint`::
9797

9898
Show a browser for the tree of the 'maint' branch. Files
9999
selected in the browser can be viewed with the internal

Documentation/git-log.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,45 +88,45 @@ include::diff-generate-patch.txt[]
8888

8989
Examples
9090
--------
91-
git log --no-merges::
91+
`git log --no-merges`::
9292

9393
Show the whole commit history, but skip any merges
9494

95-
git log v2.6.12.. include/scsi drivers/scsi::
95+
`git log v2.6.12.. include/scsi drivers/scsi`::
9696

9797
Show all commits since version 'v2.6.12' that changed any file
9898
in the include/scsi or drivers/scsi subdirectories
9999

100-
git log --since="2 weeks ago" \-- gitk::
100+
`git log --since="2 weeks ago" \-- gitk`::
101101

102102
Show the changes during the last two weeks to the file 'gitk'.
103103
The "--" is necessary to avoid confusion with the *branch* named
104104
'gitk'
105105

106-
git log --name-status release..test::
106+
`git log --name-status release..test`::
107107

108108
Show the commits that are in the "test" branch but not yet
109109
in the "release" branch, along with the list of paths
110110
each commit modifies.
111111

112-
git log --follow builtin-rev-list.c::
112+
`git log --follow builtin-rev-list.c`::
113113

114114
Shows the commits that changed builtin-rev-list.c, including
115115
those commits that occurred before the file was given its
116116
present name.
117117

118-
git log --branches --not --remotes=origin::
118+
`git log --branches --not --remotes=origin`::
119119

120120
Shows all commits that are in any of local branches but not in
121121
any of remote-tracking branches for 'origin' (what you have that
122122
origin doesn't).
123123

124-
git log master --not --remotes=*/master::
124+
`git log master --not --remotes=*/master`::
125125

126126
Shows all commits that are in local master but not in any remote
127127
repository master branches.
128128

129-
git log -p -m --first-parent::
129+
`git log -p -m --first-parent`::
130130

131131
Shows the history including change diffs, but only from the
132132
"main branch" perspective, skipping commits that come from merged

Documentation/git-merge-file.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ OPTIONS
7676
EXAMPLES
7777
--------
7878

79-
git merge-file README.my README README.upstream::
79+
`git merge-file README.my README README.upstream`::
8080

8181
combines the changes of README.my and README.upstream since README,
8282
tries to merge them and writes the result into README.my.
8383

84-
git merge-file -L a -L b -L c tmp/a123 tmp/b234 tmp/c345::
84+
`git merge-file -L a -L b -L c tmp/a123 tmp/b234 tmp/c345`::
8585

8686
merges tmp/a123 and tmp/c345 with the base tmp/b234, but uses labels
8787
`a` and `c` instead of `tmp/a123` and `tmp/c345`.

Documentation/git-push.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -327,12 +327,12 @@ a case where you do mean to lose history.
327327
Examples
328328
--------
329329

330-
git push::
330+
`git push`::
331331
Works like `git push <remote>`, where <remote> is the
332332
current branch's remote (or `origin`, if no remote is
333333
configured for the current branch).
334334

335-
git push origin::
335+
`git push origin`::
336336
Without additional configuration, works like
337337
`git push origin :`.
338338
+
@@ -344,45 +344,45 @@ use `git config remote.origin.push HEAD`. Any valid <refspec> (like
344344
the ones in the examples below) can be configured as the default for
345345
`git push origin`.
346346

347-
git push origin :::
347+
`git push origin :`::
348348
Push "matching" branches to `origin`. See
349349
<refspec> in the <<OPTIONS,OPTIONS>> section above for a
350350
description of "matching" branches.
351351

352-
git push origin master::
352+
`git push origin master`::
353353
Find a ref that matches `master` in the source repository
354354
(most likely, it would find `refs/heads/master`), and update
355355
the same ref (e.g. `refs/heads/master`) in `origin` repository
356356
with it. If `master` did not exist remotely, it would be
357357
created.
358358

359-
git push origin HEAD::
359+
`git push origin HEAD`::
360360
A handy way to push the current branch to the same name on the
361361
remote.
362362

363-
git push origin master:satellite/master dev:satellite/dev::
363+
`git push origin master:satellite/master dev:satellite/dev`::
364364
Use the source ref that matches `master` (e.g. `refs/heads/master`)
365365
to update the ref that matches `satellite/master` (most probably
366366
`refs/remotes/satellite/master`) in the `origin` repository, then
367367
do the same for `dev` and `satellite/dev`.
368368

369-
git push origin HEAD:master::
369+
`git push origin HEAD:master`::
370370
Push the current branch to the remote ref matching `master` in the
371371
`origin` repository. This form is convenient to push the current
372372
branch without thinking about its local name.
373373

374-
git push origin master:refs/heads/experimental::
374+
`git push origin master:refs/heads/experimental`::
375375
Create the branch `experimental` in the `origin` repository
376376
by copying the current `master` branch. This form is only
377377
needed to create a new branch or tag in the remote repository when
378378
the local name and the remote name are different; otherwise,
379379
the ref name on its own will work.
380380

381-
git push origin :experimental::
381+
`git push origin :experimental`::
382382
Find a ref that matches `experimental` in the `origin` repository
383383
(e.g. `refs/heads/experimental`), and delete it.
384384

385-
git push origin {plus}dev:master::
385+
`git push origin {plus}dev:master`::
386386
Update the origin repository's master branch with the dev branch,
387387
allowing non-fast-forward updates. *This can leave unreferenced
388388
commits dangling in the origin repository.* Consider the

Documentation/git-remote-fd.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,19 @@ GIT_TRANSLOOP_DEBUG::
3535

3636
EXAMPLES
3737
--------
38-
git fetch fd::17 master::
38+
`git fetch fd::17 master`::
3939
Fetch master, using file descriptor #17 to communicate with
4040
git-upload-pack.
4141

42-
git fetch fd::17/foo master::
42+
`git fetch fd::17/foo master`::
4343
Same as above.
4444

45-
git push fd::7,8 master (as URL)::
45+
`git push fd::7,8 master (as URL)`::
4646
Push master, using file descriptor #7 to read data from
4747
git-receive-pack and file descriptor #8 to write data to
4848
same service.
4949

50-
git push fd::7,8/bar master::
50+
`git push fd::7,8/bar master`::
5151
Same as above.
5252

5353
Documentation

Documentation/git-revert.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ effect to your index in a row.
9393

9494
EXAMPLES
9595
--------
96-
git revert HEAD~3::
96+
`git revert HEAD~3`::
9797

9898
Revert the changes specified by the fourth last commit in HEAD
9999
and create a new commit with the reverted changes.
100100

101-
git revert -n master{tilde}5..master{tilde}2::
101+
`git revert -n master{tilde}5..master{tilde}2`::
102102

103103
Revert the changes done by commits from the fifth last commit
104104
in master (included) to the third last commit in master

Documentation/git-rm.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,15 @@ git diff --name-only --diff-filter=D -z | xargs -0 git rm --cached
137137

138138
EXAMPLES
139139
--------
140-
git rm Documentation/\*.txt::
140+
`git rm Documentation/\*.txt`::
141141
Removes all `*.txt` files from the index that are under the
142142
`Documentation` directory and any of its subdirectories.
143143
+
144144
Note that the asterisk `*` is quoted from the shell in this
145145
example; this lets git, and not the shell, expand the pathnames
146146
of files and subdirectories under the `Documentation/` directory.
147147

148-
git rm -f git-*.sh::
148+
`git rm -f git-*.sh`::
149149
Because this example lets the shell expand the asterisk
150150
(i.e. you are listing the files explicitly), it
151151
does not remove `subdir/git-foo.sh`.

0 commit comments

Comments
 (0)