Subject: Re: [PATCH] docs: fix git stash grammar

From: Quentin Bernet <[email-masked]>
Date: Fri, 27 Mar 2026 09:25:09 +0100

This seems to be describing more the content of the patch than the 
intention behind it, what about:

The grammar for "git stash" does not contain valid combinations such as
"git stash --include-untracked"; fix it

On 3/26/26 17:17, D. Ben Knoble wrote:
> On Thu, Mar 26, 2026 at 8:46 AM Quentin Bernet via GitGitGadget
> <[email-masked]> wrote:
>> From: Quentin Bernet <[email-masked]>
>>
>> Grammar incorrectly did not include `git stash -m`
>> and other valid `git stash push` flags
> Typically commits for Git describe
> - the current situation (present tense)
> - commands to make the code better
>
> In this case, something like
>
>      The grammar for "git stash" is incorrectly bracketed; fix it.
>
> ?
>
>> Signed-off-by: Quentin Bernet <[email-masked]>
>> ---
>>      Fix git stash grammar
>>
>> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2255%2FSporarum%2Fpatch-1-v1
>> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2255/Sporarum/patch-1-v1
>> Pull-Request: https://github.com/git/git/pull/2255
>>
>>   Documentation/git-stash.adoc | 4 ++--
>>   builtin/stash.c              | 4 ++--
>>   2 files changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/Documentation/git-stash.adoc b/Documentation/git-stash.adoc
>> index 235d57ddd8..41086c21a4 100644
>> --- a/Documentation/git-stash.adoc
>> +++ b/Documentation/git-stash.adoc
>> @@ -14,10 +14,10 @@ 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]
>> +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>...]]
>> +            [--] [<pathspec>...]
>>   git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]
>>              [-u | --include-untracked] [-a | --all] [<message>]
>>   git stash clear
>> diff --git a/builtin/stash.c b/builtin/stash.c
>> index 95c5005b0b..0d27b2fb1f 100644
>> --- a/builtin/stash.c
>> +++ b/builtin/stash.c
>> @@ -50,10 +50,10 @@
>>   #define BUILTIN_STASH_STORE_USAGE \
>>          N_("git stash store [(-m | --message) <message>] [-q | --quiet] <commit>")
>>   #define BUILTIN_STASH_PUSH_USAGE \
>> -       N_("git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]\n" \
>> +       N_("git stash [push] [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]\n" \
>>             "          [-u | --include-untracked] [-a | --all] [(-m | --message) <message>]\n" \
>>             "          [--pathspec-from-file=<file> [--pathspec-file-nul]]\n" \
>> -          "          [--] [<pathspec>...]]")
>> +          "          [--] [<pathspec>...]")
>>   #define BUILTIN_STASH_SAVE_USAGE \
>>          N_("git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]\n" \
>>             "          [-u | --include-untracked] [-a | --all] [<message>]")
>>
>> base-commit: ce74208c2fa13943fffa58f168ac27a76d0eb789
>> --
>> gitgitgadget
> Now, _is_ the grammar bracketed wrong? "git help stash" says
>
>             For quickly making a snapshot, you can omit "push". In this mode,
>             non-option arguments are not allowed to prevent a misspelled
>             subcommand from making an unwanted stash entry. The two exceptions
>             to this are stash -p which acts as alias for stash push -p and
>             pathspec elements, which are allowed after a double hyphen -- for
>             disambiguation.
>
> So _if_ you want to provide options (other than "-p"), the "push" is
> required. I think the existing brackets indicate that.
>