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

Re: Subject: [RFC] stash: let the stash stack live in a configurable ref

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
Aug 25, 2026, 14:43 UTC
Message-ID
<e3e7d23c-ad66-42de-b959-f9f2fae8d16b@gmail.com>
In-Reply-To
<xmqqfr03sgyu.fsf@gitster.g>
On 24/08/2026 15:58, Junio C Hamano wrote:
Show 18 quoted lines
> Phillip Wood <phillip.wood123@gmail.com> writes:
> 
>> On a related note I've been meaning to add an option to specify an
>> alternative branch name when creating a stash, so that "git checkout -m"
>> and "git rebase --autostash <upstream> <branch>" can record the branch
>> that we're switching to, rather than the one that's currently checked
>> out when creating stashes.
> 
> Interesting.  I think we have seen ideas floated to allow per-branch
> and per-worktree stashes in the past.  I am not sure how much we
> should rely on the stash message, though.  The more heavily we rely
> on it, the more restricted the end-user messages supplied via the
> '-m' option would become.  If we were to officially support
> per-branch stashes, we may have to adopt a more structured format
> (which could be something simple like "at the end of the message
> after the last ':' is the name of the branch the stash entry
> targets", alongside a tweak to the '-m' option to always append
> ': target-branch' after whatever the user gives as the message).

We add the branch name to the beginning of the user-supplied message in create_stash(). If the user supplies the message then we prepend "On $branch: ", if the user does not supply a message we use "WIP on $branch ..." so I think we already have simple structured messages.

Thanks
Phillip
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 8 in “Subject: [RFC] stash: let the stash stack live in a configurable ref”
  1. Vladimir SitnikovAug 23, 2026
  2. Kristoffer HaugsbakkAug 23, 2026
  3. Phillip WoodAug 24, 2026
  4. Junio C HamanoAug 24, 2026
  5. Phillip WoodAug 25, 2026
  6. Junio C HamanoAug 25, 2026
  7. Vladimir SitnikovAug 25, 2026
  8. Phillip WoodAug 26, 2026

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.