Skip to content

Commit

Permalink
Merge branch 'ab/doc-synopsis-and-cmd-usage' into jch
Browse files Browse the repository at this point in the history
The short-help text shown by "git cmd -h" and the synopsis text
shown at the beginning of "git help cmd" have been made more
consistent.

* ab/doc-synopsis-and-cmd-usage: (34 commits)
  tests: start asserting that *.txt SYNOPSIS matches -h output
  doc txt & -h consistency: make "worktree" consistent
  worktree: define subcommand -h in terms of command -h
  reflog doc: list real subcommands up-front
  doc txt & -h consistency: make "commit" consistent
  doc txt & -h consistency: make "diff-tree" consistent
  doc txt & -h consistency: use "[<label>...]" for "zero or more"
  doc txt & -h consistency: make "annotate" consistent
  doc txt & -h consistency: make "stash" consistent
  doc txt & -h consistency: add missing options
  doc txt & -h consistency: use "git foo" form, not "git-foo"
  doc txt & -h consistency: make "bundle" consistent
  doc txt & -h consistency: make "read-tree" consistent
  doc txt & -h consistency: make "rerere" consistent
  doc txt & -h consistency: add missing options and labels
  doc txt & -h consistency: make output order consistent
  doc txt & -h consistency: add or fix optional "--" syntax
  doc txt & -h consistency: fix mismatching labels
  t/helper/test-proc-receive.c: use "<options>", not "<options>..."
  doc txt & -h consistency: use "<options>", not "<options>..."
  ...
  • Loading branch information
gitster committed Sep 12, 2022
2 parents 93e6d76 + 0355af6 commit 792b4f6
Show file tree
Hide file tree
Showing 78 changed files with 530 additions and 185 deletions.
17 changes: 14 additions & 3 deletions Documentation/CodingGuidelines
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,8 @@ Writing Documentation:

A few commented examples follow to provide reference when writing or
modifying command usage strings and synopsis sections in the manual
pages:
pages. The two should match, see t/t0450-txt-doc-vs-help.sh for
(partial) regression testing.

Placeholders are spelled in lowercase and enclosed in angle brackets:
<file>
Expand All @@ -650,8 +651,8 @@ Writing Documentation:
(One or more of <file>.)

Optional parts are enclosed in square brackets:
[<extra>]
(Zero or one <extra>.)
[<file>...]
(Zero or more of <file>.)

--exec-path[=<path>]
(Option with an optional argument. Note that the "=" is inside the
Expand All @@ -665,6 +666,16 @@ Writing Documentation:
[-q | --quiet]
[--utf8 | --no-utf8]

Use spacing around "|" token(s), but not on the inside of "[]()"
tokens:
Do: [-q | --quiet]
Don't: [-q|--quiet]

Don't use spacing around "|" tokens when they're used to seperate the
alternate arguments of an option:
Do: --track[=(direct|inherit)]
Don't: --track[=(direct | inherit)]

Parentheses are used for grouping:
[(<rev> | <range>)...]
(Any number of either <rev> or <range>. Parens are needed to make
Expand Down
2 changes: 1 addition & 1 deletion Documentation/git-annotate.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ git-annotate - Annotate file lines with commit information
SYNOPSIS
--------
[verse]
'git annotate' [<options>] <file> [<revision>]
'git annotate' [<options>] [<rev-opts>] [<rev>] [--] <file>

DESCRIPTION
-----------
Expand Down
6 changes: 3 additions & 3 deletions Documentation/git-clean.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ git-clean - Remove untracked files from the working tree
SYNOPSIS
--------
[verse]
'git clean' [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] <path>...
'git clean' [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] [<pathspec>...]

DESCRIPTION
-----------
Expand All @@ -20,13 +20,13 @@ Normally, only files unknown to Git are removed, but if the `-x`
option is specified, ignored files are also removed. This can, for
example, be useful to remove all build products.

If any optional `<path>...` arguments are given, only those paths
If any optional `<pathspec>...` arguments are given, only those paths
are affected.

OPTIONS
-------
-d::
Normally, when no <path> is specified, git clean will not
Normally, when no <pathspec> is specified, git clean will not
recurse into untracked directories to avoid removing too much.
Specify -d to have it recurse into such directories as well.
If any paths are specified, -d is irrelevant; all untracked
Expand Down
5 changes: 4 additions & 1 deletion Documentation/git-commit-graph.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ SYNOPSIS
--------
[verse]
'git commit-graph verify' [--object-dir <dir>] [--shallow] [--[no-]progress]
'git commit-graph write' <options> [--object-dir <dir>] [--[no-]progress]
'git commit-graph write' [--object-dir <dir>] [--append]
[--split[=<strategy>]] [--reachable|--stdin-packs|--stdin-commits]
[--changed-paths] [--[no-]max-new-filters <n>] [--[no-]progress]
<split options>


DESCRIPTION
Expand Down
2 changes: 1 addition & 1 deletion Documentation/git-credential-cache--daemon.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ git-credential-cache--daemon - Temporarily store user credentials in memory
SYNOPSIS
--------
[verse]
'git credential-cache{litdd}daemon' [--debug] <socket>
'git credential-cache{litdd}daemon' [--debug] <socket-path>

DESCRIPTION
-----------
Expand Down
2 changes: 1 addition & 1 deletion Documentation/git-diff-files.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ git-diff-files - Compares files in the working tree and the index
SYNOPSIS
--------
[verse]
'git diff-files' [-q] [-0|-1|-2|-3|-c|--cc] [<common-diff-options>] [<path>...]
'git diff-files' [-q] [-0 | -1 | -2 | -3 | -c | --cc] [<common-diff-options>] [<path>...]

DESCRIPTION
-----------
Expand Down
2 changes: 1 addition & 1 deletion Documentation/git-fast-export.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ git-fast-export - Git data exporter
SYNOPSIS
--------
[verse]
'git fast-export [<options>]' | 'git fast-import'
'git fast-export' [<options>] | 'git fast-import'

DESCRIPTION
-----------
Expand Down
3 changes: 2 additions & 1 deletion Documentation/git-hash-object.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ git-hash-object - Compute object ID and optionally creates a blob from a file
SYNOPSIS
--------
[verse]
'git hash-object' [-t <type>] [-w] [--path=<file>|--no-filters] [--stdin [--literally]] [--] <file>...
'git hash-object' [-t <type>] [-w] [--path=<file>|--no-filters]
[--stdin [--literally]] [--] <file>...
'git hash-object' [-t <type>] [-w] --stdin-paths [--no-filters]

DESCRIPTION
Expand Down
5 changes: 3 additions & 2 deletions Documentation/git-interpret-trailers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ git-interpret-trailers - Add or parse structured information in commit messages
SYNOPSIS
--------
[verse]
'git interpret-trailers' [<options>] [(--trailer <token>[(=|:)<value>])...] [<file>...]
'git interpret-trailers' [<options>] [--parse] [<file>...]
'git interpret-trailers' [--in-place] [--trim-empty]
[(--trailer <token>[(=|:)<value>])...]
[--parse] [<file>...]

DESCRIPTION
-----------
Expand Down
4 changes: 2 additions & 2 deletions Documentation/git-merge-base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ git-merge-base - Find as good common ancestors as possible for a merge
SYNOPSIS
--------
[verse]
'git merge-base' [-a|--all] <commit> <commit>...
'git merge-base' [-a|--all] --octopus <commit>...
'git merge-base' [-a | --all] <commit> <commit>...
'git merge-base' [-a | --all] --octopus <commit>...
'git merge-base' --is-ancestor <commit> <commit>
'git merge-base' --independent <commit>...
'git merge-base' --fork-point <ref> [<commit>]
Expand Down
2 changes: 1 addition & 1 deletion Documentation/git-mv.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ git-mv - Move or rename a file, a directory, or a symlink
SYNOPSIS
--------
[verse]
'git mv' <options>... <args>...
'git mv' [<options>] <source>... <destination>

DESCRIPTION
-----------
Expand Down
2 changes: 1 addition & 1 deletion Documentation/git-pack-redundant.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ git-pack-redundant - Find redundant pack files
SYNOPSIS
--------
[verse]
'git pack-redundant' [ --verbose ] [ --alt-odb ] ( --all | <pack-filename>... )
'git pack-redundant' [--verbose] [--alt-odb] (--all | <pack-filename>...)

DESCRIPTION
-----------
Expand Down
2 changes: 1 addition & 1 deletion Documentation/git-prune-packed.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ git-prune-packed - Remove extra objects that are already in pack files
SYNOPSIS
--------
[verse]
'git prune-packed' [-n|--dry-run] [-q|--quiet]
'git prune-packed' [-n | --dry-run] [-q | --quiet]


DESCRIPTION
Expand Down
2 changes: 1 addition & 1 deletion Documentation/git-read-tree.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ git-read-tree - Reads tree information into the index
SYNOPSIS
--------
[verse]
'git read-tree' [[-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>]
'git read-tree' [(-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>)
[-u | -i]] [--index-output=<file>] [--no-sparse-checkout]
(--empty | <tree-ish1> [<tree-ish2> [<tree-ish3>]])

Expand Down
2 changes: 1 addition & 1 deletion Documentation/git-receive-pack.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ git-receive-pack - Receive what is pushed into the repository
SYNOPSIS
--------
[verse]
'git-receive-pack' <directory>
'git receive-pack' <git-dir>

DESCRIPTION
-----------
Expand Down
17 changes: 7 additions & 10 deletions Documentation/git-reflog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,18 @@ git-reflog - Manage reflog information
SYNOPSIS
--------
[verse]
'git reflog' <subcommand> <options>

DESCRIPTION
-----------
The command takes various subcommands, and different options
depending on the subcommand:

[verse]
'git reflog' ['show'] [<log-options>] [<ref>]
'git reflog' [show] [<log-options>] [<ref>]
'git reflog expire' [--expire=<time>] [--expire-unreachable=<time>]
[--rewrite] [--updateref] [--stale-fix]
[--dry-run | -n] [--verbose] [--all [--single-worktree] | <refs>...]
'git reflog delete' [--rewrite] [--updateref]
[--dry-run | -n] [--verbose] <ref>@{<specifier>}...
'git reflog exists' <ref>

DESCRIPTION
-----------
This command manages the information recorded in the reflogs.

Reference logs, or "reflogs", record when the tips of branches and
other references were updated in the local repository. Reflogs are
useful in various Git commands, to specify the old value of a
Expand All @@ -33,7 +29,8 @@ moves ago", `master@{one.week.ago}` means "where master used to point
to one week ago in this local repository", and so on. See
linkgit:gitrevisions[7] for more details.

This command manages the information recorded in the reflogs.
The command takes various subcommands, and different options
depending on the subcommand:

The "show" subcommand (which is also the default, in the absence of
any subcommands) shows the log of the reference provided in the
Expand Down
2 changes: 1 addition & 1 deletion Documentation/git-rerere.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ git-rerere - Reuse recorded resolution of conflicted merges
SYNOPSIS
--------
[verse]
'git rerere' ['clear'|'forget' <pathspec>|'diff'|'remaining'|'status'|'gc']
'git rerere' [clear | forget <pathspec>... | diff | status | remaining | gc]

DESCRIPTION
-----------
Expand Down
3 changes: 2 additions & 1 deletion Documentation/git-send-pack.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ git-send-pack - Push objects over Git protocol to another repository
SYNOPSIS
--------
[verse]
'git send-pack' [--dry-run] [--force] [--receive-pack=<git-receive-pack>]
'git send-pack' [--mirror] [--dry-run] [--force]
[--receive-pack=<git-receive-pack>]
[--verbose] [--thin] [--atomic]
[--[no-]signed|--signed=(true|false|if-asked)]
[<host>:]<directory> (--all | <ref>...)
Expand Down
4 changes: 2 additions & 2 deletions Documentation/git-show-branch.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ git-show-branch - Show branches and their commits
SYNOPSIS
--------
[verse]
'git show-branch' [-a|--all] [-r|--remotes] [--topo-order | --date-order]
'git show-branch' [-a | --all] [-r | --remotes] [--topo-order | --date-order]
[--current] [--color[=<when>] | --no-color] [--sparse]
[--more=<n> | --list | --independent | --merge-base]
[--no-name | --sha1-name] [--topics]
[(<rev> | <glob>)...]
'git show-branch' (-g|--reflog)[=<n>[,<base>]] [--list] [<ref>]
'git show-branch' (-g | --reflog)[=<n>[,<base>]] [--list] [<ref>]

DESCRIPTION
-----------
Expand Down
4 changes: 2 additions & 2 deletions Documentation/git-show-ref.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ git-show-ref - List references in a local repository
SYNOPSIS
--------
[verse]
'git show-ref' [-q|--quiet] [--verify] [--head] [-d|--dereference]
[-s|--hash[=<n>]] [--abbrev[=<n>]] [--tags]
'git show-ref' [-q | --quiet] [--verify] [--head] [-d | --dereference]
[-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]
[--heads] [--] [<pattern>...]
'git show-ref' --exclude-existing[=<pattern>]

Expand Down
2 changes: 1 addition & 1 deletion Documentation/git-sparse-checkout.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ git-sparse-checkout - Reduce your working tree to a subset of tracked files
SYNOPSIS
--------
[verse]
'git sparse-checkout <subcommand> [<options>]'
'git sparse-checkout' (init | list | set | add | reapply | disable) [<options>]


DESCRIPTION
Expand Down
17 changes: 10 additions & 7 deletions Documentation/git-stash.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@ SYNOPSIS
--------
[verse]
'git stash' list [<log-options>]
'git stash' show [-u|--include-untracked|--only-untracked] [<diff-options>] [<stash>]
'git stash' drop [-q|--quiet] [<stash>]
'git stash' ( pop | apply ) [--index] [-q|--quiet] [<stash>]
'git stash' show [-u | --include-untracked | --only-untracked] [<diff-options>] [<stash>]
'git stash' drop [-q | --quiet] [<stash>]
'git stash' pop [--index] [-q | --quiet] [<stash>]
'git stash' apply [--index] [-q | --quiet] [<stash>]
'git stash' branch <branchname> [<stash>]
'git stash' [push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--quiet]
[-u|--include-untracked] [-a|--all] [-m|--message <message>]
'git stash' [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]
[-u | --include-untracked] [-a | --all] [(-m | --message) <message>]
[--pathspec-from-file=<file> [--pathspec-file-nul]]
[--] [<pathspec>...]]
'git stash' save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]
[-u | --include-untracked] [-a | --all] [<message>]
'git stash' clear
'git stash' create [<message>]
'git stash' store [-m|--message <message>] [-q|--quiet] <commit>
'git stash' store [(-m | --message) <message>] [-q | --quiet] <commit>

DESCRIPTION
-----------
Expand Down Expand Up @@ -47,7 +50,7 @@ stash index (e.g. the integer `n` is equivalent to `stash@{n}`).
COMMANDS
--------

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>...]::
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>...]::

Save your local modifications to a new 'stash entry' and roll them
back to HEAD (in the working tree and in the index).
Expand Down
2 changes: 1 addition & 1 deletion Documentation/git-status.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ git-status - Show the working tree status
SYNOPSIS
--------
[verse]
'git status' [<options>...] [--] [<pathspec>...]
'git status' [<options>] [--] [<pathspec>...]

DESCRIPTION
-----------
Expand Down
2 changes: 1 addition & 1 deletion Documentation/git-tag.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ git-tag - Create, list, delete or verify a tag object signed with GPG
SYNOPSIS
--------
[verse]
'git tag' [-a | -s | -u <keyid>] [-f] [-m <msg> | -F <file>] [-e]
'git tag' [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] [-e]
<tagname> [<commit> | <object>]
'git tag' -d <tagname>...
'git tag' [-n[<num>]] -l [--contains <commit>] [--no-contains <commit>]
Expand Down
8 changes: 7 additions & 1 deletion Documentation/git-update-server-info.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ git-update-server-info - Update auxiliary info file to help dumb servers
SYNOPSIS
--------
[verse]
'git update-server-info'
'git update-server-info' [-f | --force]

DESCRIPTION
-----------
Expand All @@ -19,6 +19,12 @@ $GIT_OBJECT_DIRECTORY/info directories to help clients discover
what references and packs the server has. This command
generates such auxiliary files.

OPTIONS
-------
-f::
--force::
Allow adding otherwise ignored files.

OUTPUT
------

Expand Down
4 changes: 2 additions & 2 deletions Documentation/git-upload-archive.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ git-upload-archive - Send archive back to git-archive
SYNOPSIS
--------
[verse]
'git upload-archive' <directory>
'git upload-archive' <repository>

DESCRIPTION
-----------
Expand Down Expand Up @@ -54,7 +54,7 @@ access via non-smart-http.

OPTIONS
-------
<directory>::
<repository>::
The repository to get a tar archive from.

GIT
Expand Down
2 changes: 1 addition & 1 deletion Documentation/git-var.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ git-var - Show a Git logical variable
SYNOPSIS
--------
[verse]
'git var' ( -l | <variable> )
'git var' (-l | <variable>)

DESCRIPTION
-----------
Expand Down
2 changes: 1 addition & 1 deletion Documentation/git-verify-commit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ git-verify-commit - Check the GPG signature of commits
SYNOPSIS
--------
[verse]
'git verify-commit' <commit>...
'git verify-commit' [-v | --verbose] <commit>...

DESCRIPTION
-----------
Expand Down

0 comments on commit 792b4f6

Please sign in to comment.