git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Manuel Ricci <manuelricciwc@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Possible typo in git stash doc page
Date: Wed, 12 Jul 2023 08:49:12 -0700	[thread overview]
Message-ID: <xmqq1qhduo3r.fsf@gitster.g> (raw)
In-Reply-To: <CAMvNOSqDgDnchNdNq7AvBYbMTFfy0mWMygHnX_8HjTAnBA=AnQ@mail.gmail.com> (Manuel Ricci's message of "Wed, 12 Jul 2023 17:01:29 +0200")

Manuel Ricci <manuelricciwc@gmail.com> writes:

> In the doc page about git stash, specifically where there're the
> details about git stash push
> https://git-scm.com/docs/git-stash#Documentation/git-stash.txt-push-p--patch-S--staged-k--no-keep-index-u--include-untracked-a--all-q--quiet-m--messageltmessagegt--pathspec-from-fileltfilegt--pathspec-file-nul--ltpathspecgt82308203
>
> There's a reference about --staged or -S. I tried to execute the
> command with that flag and the output is like this one:
>
> error: unknown switch `S'
> usage: git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]
> ...
> Even if the flag is --staged
>
> error: unknown option `staged'
> usage: git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]
> ...

This is not a very reproducibly-helpful bug report.  Re-reading the
above, we do not even learn what exact command you typed, and what
the state the repository you saw the error message was in.

In a random repository I happened to be in, that had Makefile tracked,
I did this:

    $ git version
    git version 2.41.0-327-gaa9166bcc0
    $ git stash -S
    No local changes to save.
    $ echo "# junk" >>Makefile
    $ git stash -S
    No staged changes.
    $ git add Makefile
    $ git stash -S
    Saved working directory and index state WIP on ...

The commands in various state seem to be working as expected.  It
would complain when there is nothing to save, it complains
differently when there is something to save but the change is not in
the index, and it reports what it did when it did save.

The option was implemented with 41a28eb6 (stash: implement
'--staged' option for 'push' and 'save', 2021-10-18) that first
appeared in Git 2.35, so it is possible that the version of Git
you are using is too old to have it, but from your bug report we
cannot tell if that is the case.

HTH?

      reply	other threads:[~2023-07-12 15:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-12 15:01 Possible typo in git stash doc page Manuel Ricci
2023-07-12 15:49 ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq1qhduo3r.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=manuelricciwc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).