Skip to content

Commit

Permalink
Documentation: explain optional arguments better
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Matthieu Moy authored and Junio C Hamano committed Sep 21, 2015
1 parent 318ca61 commit 2b594bf
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 10 deletions.
4 changes: 3 additions & 1 deletion Documentation/git-am.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ default. You can use `--no-utf8` to override this.

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

--continue::
-r::
Expand Down
4 changes: 3 additions & 1 deletion Documentation/git-cherry-pick.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ effect to your index in a row.

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

--ff::
If the current HEAD is the same as the parent of the
Expand Down
4 changes: 3 additions & 1 deletion Documentation/git-commit-tree.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ OPTIONS

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

--no-gpg-sign::
Countermand `commit.gpgSign` configuration variable that is
Expand Down
4 changes: 3 additions & 1 deletion Documentation/git-commit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,9 @@ changes to tracked files.

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

--no-gpg-sign::
Countermand `commit.gpgSign` configuration variable that is
Expand Down
5 changes: 4 additions & 1 deletion Documentation/git-grep.txt
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ OPTIONS
Open the matching files in the pager (not the output of 'grep').
If the pager happens to be "less" or "vi", and the user
specified only one pattern, the first file is positioned at
the first match automatically.
the first match automatically. The `pager` argument is
optional; if specified, it must be stuck to the option
without a space. If `pager` is unspecified, the default pager
will be used (see `core.pager` in linkgit:git-config[1]).

-z::
--null::
Expand Down
4 changes: 3 additions & 1 deletion Documentation/git-merge.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ include::merge-options.txt[]

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

-m <msg>::
Set the commit message to be used for the merge commit (in
Expand Down
4 changes: 3 additions & 1 deletion Documentation/git-rebase.txt
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,9 @@ which makes little sense.

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

-q::
--quiet::
Expand Down
4 changes: 3 additions & 1 deletion Documentation/git-revert.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ effect to your index in a row.

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

-s::
--signoff::
Expand Down
5 changes: 3 additions & 2 deletions Documentation/git-status.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ OPTIONS
--untracked-files[=<mode>]::
Show untracked files.
+
The mode parameter is optional (defaults to 'all'), and is used to
specify the handling of untracked files.
The mode parameter is used to specify the handling of untracked files.
It is optional: it defaults to 'all', and if specified, it must be
stuck to the option (e.g. `-uno`, but not `-u no`).
+
The possible options are:
+
Expand Down

0 comments on commit 2b594bf

Please sign in to comment.