git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hanan Arshad <hananarshad619@gmail.com>
To: sandals@crustytoothpaste.net
Cc: git@vger.kernel.org
Subject: Re: [RFC] git stash: add porcelain for sharing stashes through remotes
Date: Mon,  5 Oct 2026 10:53:37 +0500	[thread overview]
Message-ID: <20261005055337.7579-1-hananarshad619@gmail.com> (raw)
In-Reply-To: <arw5XxJPNlUxU8TS@fruit.crustytoothpaste.net>

Hi Brian,

Thanks for the detailed feedback. I reconsidered the design based on your comments, particularly the point that the appropriate remote namespace depends on the user and environment.

I agree that Git should not impose a fixed namespace such as:

refs/stashes/<author>/<name>

Instead, the remote ref should be explicitly chosen by the user. For example:

refs/stashes/hanan/fix-login
refs/stashes/fix-login
refs/heads/hanan/stash
refs/heads/stash

The tooling would provide the stash transport workflow without standardizing where the remote stores it.

The revised interface I have in mind is:

Publish one stash to a user-selected remote ref:

git stash publish <remote> <remote-ref> [<stash>]

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.

List matching remote refs without downloading their objects:

git stash list --remote <remote> [<ref-pattern>]

For example:

git stash list --remote origin 'refs/stashes/*'

This would list refs only rather than downloading each stash to obtain its description. As you pointed out, stashes may be large, so fetching their contents merely for listing would be unnecessarily expensive.

Retrieve one or more stashes from remote refs:

git stash get <remote> <remote-ref>
git stash get <remote> <ref-pattern>

A single ref retrieves one stash:

git stash get origin refs/stashes/hanan/fix-login

An explicit pattern could retrieve multiple stashes:

git stash get origin 'refs/stashes/hanan/*'

Each matching ref would be fetched and passed through the existing stash import logic, producing normal local stash entries.

Prefix matching would not be implicit. For example:

git stash get origin refs/stashes/hanan

would refer only to that exact ref. The user would need to specify refs/stashes/hanan/* to retrieve refs below that namespace.

No tracking relationship would be established between the imported local stashes and the remote refs.

Remove one or more shared stashes by deleting their remote refs:

git stash remove <remote> <remote-ref>
git stash remove <remote> <ref-pattern>

A single ref:

git stash remove origin refs/stashes/hanan/fix-login

Multiple refs:

git stash remove origin 'refs/stashes/hanan/*'

Again, wildcard matching would need to be explicit rather than treating a ref prefix as a namespace automatically.

This would use the normal remote ref deletion mechanism. Existing local copies would remain unaffected.

publish would always operate on one stash, while get and remove could operate on either a single remote ref or an explicitly specified set of matching refs.

Human-readable ref names would be used rather than requiring users to work with object IDs.

The overall implementation would remain:

local stash
    -> stash export
    -> push to user-selected remote ref
    -> fetch
    -> stash import
    -> normal local stash

So the proposal would add porcelain around the existing mechanisms without imposing a universal remote stash namespace.

Does this direction address your concern about standardization?

Also, do you think it makes sense to pursue all four operations as porcelain, or would you prefer starting with only git stash publish and leaving listing, retrieval, and removal to existing Git commands?

Thanks,
Hanan Arshad

  reply	other threads:[~2026-10-05  5:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28 14:27 [RFC] git stash: add porcelain for sharing stashes through remotes Hanan Arshad
2026-09-29 22:19 ` brian m. carlson
2026-10-05  5:53   ` Hanan Arshad [this message]
2026-10-05  7:47     ` Johannes Sixt
2026-10-05  8:03       ` Hanan Arshad
2026-10-05  8:21         ` Johannes Sixt
2026-10-05  9:06           ` Hanan Arshad
2026-10-05 15:25             ` Junio C Hamano
2026-10-07  6:31               ` Hanan Arshad
2026-10-07 10:36                 ` Johannes Sixt
  -- strict thread matches above, loose matches on Subject: below --
2026-10-01  8:53 Hanan Arshad
2026-10-01 22:02 ` D. Ben Knoble
2026-10-01 22:16   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261005055337.7579-1-hananarshad619@gmail.com \
    --to=hananarshad619@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).