git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: error(?) in "man git-stash" regarding "--keep-index"

From
MÅMartin Ågren <martin.agren@gmail.com>
Date
May 18, 2018, 10:41 UTC
Message-ID
<CAN0heSrJMFij9xt6RstLD16+2CxJ_HALer4iRL74AZQvH0VWRQ@mail.gmail.com>
In-Reply-To
<alpine.LFD.2.21.1805180534170.6786@localhost.localdomain>
On 18 May 2018 at 11:37, Robert P. J. Day <rpjday@crashcourse.ca> wrote:
Show 11 quoted lines
>
>   toward the bottom of "man git-stash", one reads part of an example:
>
>   # ... hack hack hack ...
>   $ git add --patch foo            # add just first part to the index
>   $ git stash push --keep-index    # save all other changes to the stash
>                                               ^^^^^ ???
>
> i thought that, even if "--keep-index" left staged changes in the
> index, it still included those staged changes in the stash. that's not
> the impression one gets from the above.
So would the error be in the part of the man-page quoted below?
  If the --keep-index option is used, all changes already added to
  the index are left intact.

That is, this doesn't say *where* things are left intact (in the index? in the working tree?). The man-page does start with

  git-stash - Stash the changes in a dirty working directory away

which to me suggests that "leaving something intact" refers to precisely this -- the working directory.

Or is it the name of the option that trips you up? That is, you read the name as `--keep-the-index-as-is-but-stash-as-usual`, as opposed to `--keep-what-is-already-in-the-index-around`?

While I'm sure that some clarification could be provided, I'm tempted to argue that is exactly what the example provides that you quoted from.

Martin
Previous: Robert P. J. DayNext: Robert P. J. Day
Message 2 of 9 in “error(?) in "man git-stash" regarding "--keep-index"”
  1. Robert P. J. DayMay 18, 2018
  2. Martin ÅgrenMay 18, 2018
  3. Robert P. J. DayMay 18, 2018
  4. Martin ÅgrenMay 18, 2018
  5. Sybille PetersMay 18, 2018
  6. Robert P. J. DayMay 18, 2018
  7. Martin ÅgrenMay 18, 2018
  8. Sybille PetersMay 19, 2018
  9. Robert P. J. DayMay 18, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.