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

`git stash show` "forgets" about untracked files

From
ΣΝΣταύρος Ντέντος <stdedos@gmail.com>
Date
May 28, 2019, 08:52 UTC
Message-ID
<CAHMHMxWzchXG_Ct3=n9OP=3Q-ENjt7BkGQ2iWDAE3eYhv4MpyQ@mail.gmail.com>
Hello there,

I have saved some new untraced files, along with some tracked files in a stash, in order to start making small commits. However, it seems that doing `git stash show`, will leave no trace about untracked files being bundled inside.

For example:
#                                 tracked -- untracked
user@host:repo/folder$ git stash push -u file.ctrl file1.ctrl
file2.ctrl file3.ctrl file4.ctrl -m 'New feature with untrackeds'
Saved working directory and index state WIP on feature/auth_saml:
03cd4d56538 fixup! drop! squash! NGFW-16257 QA: Configure Identity
Provider with Ansible with asd2
fatal: pathspec 'folder/-m' did not match any files  #[1]
error: unrecognized input
user@host:repo/folder$ git stash show
 file.ctrl | 4 ++++
 1 file changed, 4 insertions(+)
user@host:repo/folder$ git stash pop
file1.ctrl already exists, no checkout
file2.ctrl already exists, no checkout
file3.ctrl already exists, no checkout
file4.ctrl already exists, no checkout
Could not restore untracked files from stash entry
$  git --version
git version 2.21.0
---------------------------------------

I understand that I could probably have staged them, and then commit maybe? I didn't want that at the time though

---------------------------------------

[1]: This also seems to be a bug. I understand I wrote it wrong, but, since I haven't used `--`, I am not sure if `git` has the right to assume that `-m` is a filename. However, the command has finished correctly.

Ντέντος Σταύρος
Message 1 of 1 in “`git stash show` "forgets" about untracked files”
  1. Σταύρος ΝτέντοςMay 28, 2019

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.