Web lists-archives.com

Re: Viewing untracked+stashed files in git stash show


On Fri, Mar 17, 2017 at 9:50 AM, Okash Khawaja <okash.khawaja@xxxxxxxxx> wrote:
> Hi,
> On Fri, Mar 17, 2017 at 8:20 AM,  <stefan.naewe@xxxxxxxxxxxxxxxxxxxx> wrote:
>> Am 16.03.2017 um 17:34 schrieb Okash Khawaja:
>>> Hi,
>>> If you have some untracked files and your run `git stash -u`. Then
>>> `git stash show` doesn't show the untracked files. Is there a flag
>>> that can be passed to git stash show to report untracked files?
>> Not for 'git stash' but you can use 'git show stash@{0}^3
> Okay that's fine as long as you know. But the first thing that comes
> to your mind is that you've lost those untracked files. Is there a
> reason why git stash show doesn't show those files?

Here's some more interesting behaviour when stashing untracked files.

Add new files (untracked) + modify some tracked files -> `git stash
-u` -> modify the stashed files in a way that `git stash pop` will
fail -> `git stash pop` -> it fails so now you would expect none of
the stashed files restored but instead the untracked stashed files

This combined with the fact that `git stash show` doesn't show
untracked files suggest that untracked files go into an undefined (or
at least undocumented) state when it comes to git stash. Is that
something that needs to be looked at?