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

Git stash create with untracked files?

From
Tao Klerks <tao@klerks.biz>
Date
Apr 27, 2022, 10:42 UTC
Message-ID
<CAPMMpoj1pF=FfRg6Rgz6bP2mZaQhApL7QQx9=2U7i4AE4zsJ1w@mail.gmail.com>
Hi folks,

I'm just checking in case I'm missing something: Is there any way to tell "git stash create" to include untracked files?

Someone recently brought up a situation where they'd like to take a working directory state (incl untracked but not-ignored files), and reproduce it in another working directory on another machine; "git stash create" seems to be ideal for this purpose, save for the (apparent) lack of arguments support.

If this is not possible today and we wanted to better support this usecase, what would be a sensible way to do it? I can see three possible directions:

1) Change the "create" subcommand to treat specific options as options
rather than the stash message (and make it understand -u /
--include-untracked)
2) Create a new subcommand like "create" that actually supported
relevant options (--include-untracked, --staged, maybe also
pathspecs), without changing the contract of "create"
3) Add an option to the "save" subcommand, asking it to actually leave
the working tree untouched (like create does) - and then expect the
user of this usecase to "drop".

It's possible to just use the existing "push" and then immediately "pop", but the resulting temporary changes to the working tree could make things like IDEs go into an unhappy indexing frenzy, depending on the amount of local change.

I realize there's the "make stashes refs" work ongoing that's related to this, but I don't think I've seen anything there that directly addresses this "make my local changes be available over there *without* touching my working tree" requirement.

Thanks, Tao

Next: brian m. carlson
Message 1 of 2 in “Git stash create with untracked files?”
  1. Tao KlerksApr 27, 2022
  2. brian m. carlsonApr 27, 2022

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.