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

A cross between 'git stash create' and 'git stash push --include-untracked'?

From
ASAlexander Shpilkin <ashpilkin@gmail.com>
Date
Mar 30, 2025, 14:37 UTC
Message-ID
<d8f596cfac9b001350b8b5e408067bb4caa073a7.camel@gmail.com>
Hi,

I'm trying to write a script for my use that would run before every invocation of 'make' and record the working tree state at that point. Stripping out the boring parts, it is basically just

    git update-ref --create-reflog refs/build $(git stash create)

but the problem is that what I want is less like 'git stash create' and more like 'git stash create --include-untracked', in case there are any new and as yet untracked source files that are nevertheless picked up by the build system.

Of course, that does not exist and, because of the syntax of 'git stash create', cannot exist. I've looked at the code in builtin/stash.c and it looks like there are only two callers of do_create_stash(): one is create_stash() and hardcodes the include_untracked argument to zero, the other is do_push_stash() and (assuming I try to undo its effects with 'git stash pop' afterwards) will potentially destroy my working tree's mtimes and cause more rebuilding than necessary. So it seems like I'm stuck here.

Any suggestions?
-- 
Thanks,
Alex
Next: Patrick Steinhardt
Message 1 of 2 in “A cross between 'git stash create' and 'git stash push --include-untracked'?”
  1. Alexander ShpilkinMar 30, 2025
  2. Patrick SteinhardtMar 31, 2025

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.