Subject: Re: Bug report: Untracked file lost from git stash

From: Junio C Hamano <[email-masked]>
Date: Thu, 25 Sep 2025 14:06:38 -0700

Hosam Aly <[email-masked]> writes:

> Feature request: I wish that the maintainers would consider changing
> the default value of `stash.showIncludeUntracked` to true. If
> something is stashed and the user asks about it, they should be told
> about it without hiding anything. Consider the case where all the
> stashed files are untracked; `git stash show` currently shows nothing,
> which is very confusing.

Do we include untracked paths in the stash by default without
configuration and/or command line option?  If we do, then such a
change will affect so many folks that it would be possible to do so
only at a large version boundary, like Git 3.0.

But untracked paths are not recorded by default, and a stash entry
that records the untracked ones is a sign enough that the user cares
about these untracked ones when the stash entry was created.

Even though I do dislike any suggestion to change existing behaviour
established more than a few years, I would be more sympathetic than
usual to a wish for such a change in the default.  In other words, I
tend to agree that the default should show untracked if recorded.  I
am actually tempted to argue that the presence of the configuration
variable stash.showIncludeUntracked and the "--include-untracked"
command line option is a bug ;-) but I won't.

Thanks.