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

Re: "man git-stash" explanation of "--include-untracked" and "--all" seems ambiguous

From
Thomas Gummerer <t.gummerer@gmail.com>
Date
Oct 1, 2017, 20:16 UTC
Message-ID
<20171001201604.GA30301@hank>
In-Reply-To
<alpine.LFD.2.21.1709290650530.1446@localhost.localdomain>
On 09/29, Robert P. J. Day wrote:
Show 13 quoted lines
> 
>   from the man page:
> 
> "If the --include-untracked option is used, all untracked files are
> also stashed and then cleaned up with git clean, leaving the working
> directory in a very clean state. If the --all option is used instead
>                                                              ^^^^^^^
> then the ignored files are stashed and cleaned in addition to the
> untracked files."
> 
>   the use of the word "instead" suggests you can use one of those
> options, or the other, but not both at the same time. but it seems you
> can combine them, so that paragraph seems a bit misleading, no?

Looking at the code, really only one (the last one that's specified on the command line) is respected, so I think the man page is correct. This happens silently, where I guess your impression that it's possible to combine them comes from.

This is fine when --include-untracked is specified first, as --all implies --include-untracked, but I guess the behaviour could be a bit surprising if --all is specified first and --include-untracked later on the command line.

Changing this could possibly break someone that just adds parameters to their 'git stash' invocation, but I'm tempted to say allowing both at once is a bug, and change it to make git die when both are specified. Do you have any inserest in submitting a patch that fixes this? :)

Show 12 quoted lines
> rday
> 
> -- 
> 
> ========================================================================
> Robert P. J. Day                                 Ottawa, Ontario, CANADA
>                         http://crashcourse.ca
> 
> Twitter:                                       http://twitter.com/rpjday
> LinkedIn:                               http://ca.linkedin.com/in/rpjday
> ========================================================================
> 
Previous: Robert P. J. DayNext: Robert P. J. Day
Message 2 of 6 in “"man git-stash" explanation of "--include-untracked" and "--all" seems ambiguous”
  1. Robert P. J. DaySep 29, 2017
  2. Thomas GummererOct 1, 2017
  3. Robert P. J. DayOct 1, 2017
  4. Junio C HamanoOct 1, 2017
  5. Robert P. J. DayOct 4, 2017
  6. Junio C HamanoOct 5, 2017

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.