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
Robert P. J. Day <rpjday@crashcourse.ca>
Date
Oct 1, 2017, 20:44 UTC
Message-ID
<alpine.LFD.2.21.1710011643070.27165@localhost.localdomain>
In-Reply-To
<20171001201604.GA30301@hank>
On Sun, 1 Oct 2017, Thomas Gummerer wrote:
Show 32 quoted lines
> On 09/29, Robert P. J. Day wrote:
> >
> >   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? :)
  sure, might as well jump in with both feet. is there another example
in the code of mutually exclusive options so i can just steal the
error code?
rday
-- 
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
Previous: Thomas GummererNext: Junio C Hamano
Message 3 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.