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

Re: Bug: "git stash create" ignores "message" argument

From
Jeff King <peff@peff.net>
Date
Jul 6, 2025, 03:25 UTC
Message-ID
<20250706032512.GB3041790@coredump.intra.peff.net>
In-Reply-To
<CAKMuBmSeFh63212_GhBHfOTbW5VaqvQjo7jz4aowm8bntCXkVw@mail.gmail.com>
On Sun, Jul 06, 2025 at 11:28:46AM +1000, José Miguel Armijo Fidalgo wrote:
Show 11 quoted lines
> What did you do before the bug happened? (Steps to reproduce your issue)
>     $ git stash create "example message"
>     1e9b483d1f9477de5c99a708f4aa512ba
>     $ git stash store 1e9b483d1f9477de5c99a708f4aa512ba
>     $ git stash list
> 
> What did you expect to happen? (Expected behavior)
>      stash@{0}: example message
> 
> What happened instead? (Actual behavior)
>      stash@{0}: Created via "git stash store".
Hmm. Is it "stash create" that is the problem, or "stash store"?
If I do this:
  git init
  echo foo >file
  git add file
  git commit -m foo
  echo bar >file
  commit=$(git stash create "example message")
and then look at the resulting commit:
  git cat-file commit $commit
then it has the expected commit message "On main: example message".

But when we "git stash store" it, the matching reflog message is the generic "created via git stash store" one. And that reflog message is what is shown by "stash list" (because it is essentially just a reflog walk of the stash ref).

So (just guessing) the intended usage is probably:
  commit=$(git stash create "$msg")
  git stash store -m "$msg" $commit

Which is a bit awkward, but then the point of these sub-commands is for scripted use (I did not even know we had them until seeing this thread).

So perhaps we'd want one or both of:
  1. A documentation fix to make it clear that if you want to behave the
     same as "stash push" you should feed the message to both "create"
     and "store".
  2. Possibly "stash store" could pull the default message from the
     commit, rather than using the generic one.
-Peff
Previous: José Miguel Armijo FidalgoNext: Junio C Hamano
Message 2 of 8 in “Bug: "git stash create" ignores "message" argument”
  1. José Miguel Armijo FidalgoJul 6, 2025
  2. Jeff KingJul 6, 2025
  3. Junio C HamanoJul 8, 2025
  4. Jeff KingJul 8, 2025
  5. José Miguel Armijo FidalgoJul 9, 2025
  6. Darren RambaudJul 6, 2025
  7. José Miguel Armijo FidalgoJul 8, 2025
  8. Junio C HamanoJul 8, 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.