Re: [RFC] git stash: add porcelain for sharing stashes through remotes
- From
Johannes Sixt <j6t@kdbg.org>
- Date
- Oct 5, 2026, 07:47 UTC
- Message-ID
- <e1635b9c-bc03-4835-805f-5fa52f09364d@kdbg.org>
- In-Reply-To
- <20261005055337.7579-1-hananarshad619@gmail.com>
Am 05.10.26 um 07:53 schrieb Hanan Arshad:
Show 5 quoted lines
> The revised interface I have in mind is: > > Publish one stash to a user-selected remote ref: > > git stash publish <remote> <remote-ref> [<stash>]
I am actually not very happy with such an interface. The premise to have it is that stashes are something that can (and should) be shared with other people. But this is not the case. Stashes are strictly personal, short-lived, work-in-progress-not-worth-to-be-committed states. If you use stashes for longer-lived, worth-to-be-committed, sharable project states, then you are doing something wrong. You should be using branch labels instead.
Show 9 quoted lines
>
> For example:
>
> git stash publish origin refs/stashes/hanan/fix-login stash@{0}
>
> If <stash> is omitted, stash@{0} would be used.
>
> Internally this would reuse the existing stash export mechanism and
> normal push machinery. The original local stash would remain unchanged.There you have it. If a stash is worth to be shown, then do take the long way via `git stash export`, and push the ref. Or just do
git push origin stash@{0}:refs/stashes/hanan/fix-loginThere's no magic support needed (nor, IMHO, desired).
-- Hannes