Skip to content

Commit 2b594bf

Browse files
moygitster
authored andcommitted
Documentation: explain optional arguments better
Improve the documentation of commands taking optional arguments in two ways: * Documents the behavior of '-O' (for grep) and '-S' (for commands creating commits) when used without the optional argument. * Document the syntax of these options. For the second point, the behavior is documented in gitcli(7), but it is easy for users to miss, and hard for the same user to understand why e.g. "git status -u no" does not work. Document this explicitly in the documentation of each short option having an optional argument: they are the most error prone since there is no '=' sign between the option and its argument. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 318ca61 commit 2b594bf

File tree

9 files changed

+28
-10
lines changed

9 files changed

+28
-10
lines changed

Documentation/git-am.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ default. You can use `--no-utf8` to override this.
138138

139139
-S[<keyid>]::
140140
--gpg-sign[=<keyid>]::
141-
GPG-sign commits.
141+
GPG-sign commits. The `keyid` argument is optional and
142+
defaults to the committer identity; if specified, it must be
143+
stuck to the option without a space.
142144

143145
--continue::
144146
-r::

Documentation/git-cherry-pick.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ effect to your index in a row.
103103

104104
-S[<keyid>]::
105105
--gpg-sign[=<keyid>]::
106-
GPG-sign commits.
106+
GPG-sign commits. The `keyid` argument is optional and
107+
defaults to the committer identity; if specified, it must be
108+
stuck to the option without a space.
107109

108110
--ff::
109111
If the current HEAD is the same as the parent of the

Documentation/git-commit-tree.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ OPTIONS
5656

5757
-S[<keyid>]::
5858
--gpg-sign[=<keyid>]::
59-
GPG-sign commit.
59+
GPG-sign commits. The `keyid` argument is optional and
60+
defaults to the committer identity; if specified, it must be
61+
stuck to the option without a space.
6062

6163
--no-gpg-sign::
6264
Countermand `commit.gpgSign` configuration variable that is

Documentation/git-commit.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,9 @@ changes to tracked files.
314314

315315
-S[<keyid>]::
316316
--gpg-sign[=<keyid>]::
317-
GPG-sign commit.
317+
GPG-sign commits. The `keyid` argument is optional and
318+
defaults to the committer identity; if specified, it must be
319+
stuck to the option without a space.
318320

319321
--no-gpg-sign::
320322
Countermand `commit.gpgSign` configuration variable that is

Documentation/git-grep.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,10 @@ OPTIONS
165165
Open the matching files in the pager (not the output of 'grep').
166166
If the pager happens to be "less" or "vi", and the user
167167
specified only one pattern, the first file is positioned at
168-
the first match automatically.
168+
the first match automatically. The `pager` argument is
169+
optional; if specified, it must be stuck to the option
170+
without a space. If `pager` is unspecified, the default pager
171+
will be used (see `core.pager` in linkgit:git-config[1]).
169172

170173
-z::
171174
--null::

Documentation/git-merge.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ include::merge-options.txt[]
6767

6868
-S[<keyid>]::
6969
--gpg-sign[=<keyid>]::
70-
GPG-sign the resulting merge commit.
70+
GPG-sign the resulting merge commit. The `keyid` argument is
71+
optional and defaults to the committer identity; if specified,
72+
it must be stuck to the option without a space.
7173

7274
-m <msg>::
7375
Set the commit message to be used for the merge commit (in

Documentation/git-rebase.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,9 @@ which makes little sense.
285285

286286
-S[<keyid>]::
287287
--gpg-sign[=<keyid>]::
288-
GPG-sign commits.
288+
GPG-sign commits. The `keyid` argument is optional and
289+
defaults to the committer identity; if specified, it must be
290+
stuck to the option without a space.
289291

290292
-q::
291293
--quiet::

Documentation/git-revert.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ effect to your index in a row.
8282

8383
-S[<keyid>]::
8484
--gpg-sign[=<keyid>]::
85-
GPG-sign commits.
85+
GPG-sign commits. The `keyid` argument is optional and
86+
defaults to the committer identity; if specified, it must be
87+
stuck to the option without a space.
8688

8789
-s::
8890
--signoff::

Documentation/git-status.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ OPTIONS
5353
--untracked-files[=<mode>]::
5454
Show untracked files.
5555
+
56-
The mode parameter is optional (defaults to 'all'), and is used to
57-
specify the handling of untracked files.
56+
The mode parameter is used to specify the handling of untracked files.
57+
It is optional: it defaults to 'all', and if specified, it must be
58+
stuck to the option (e.g. `-uno`, but not `-u no`).
5859
+
5960
The possible options are:
6061
+

0 commit comments

Comments
 (0)