git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "D. Ben Knoble" <ben.knoble@gmail.com>
To: "brian m. carlson" <sandals@crustytoothpaste.net>,
	"D. Ben Knoble" <ben.knoble@gmail.com>,
	 git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	 Phillip Wood <phillip.wood123@gmail.com>
Subject: Re: [PATCH v5 0/4] Importing and exporting stashes to refs
Date: Sat, 10 May 2025 15:13:06 -0400	[thread overview]
Message-ID: <CALnO6CAeVzh0OhjD8CkXKEydP4SNkCODfmirMYvzG8xEYXPA=Q@mail.gmail.com> (raw)
In-Reply-To: <aB5iUmASx7BxgbAj@tapette.crustytoothpaste.net>

On Fri, May 9, 2025 at 4:15 PM brian m. carlson
<sandals@crustytoothpaste.net> wrote:
>
> On 2025-05-09 at 16:53:17, D. Ben Knoble wrote:
> > - Can't we "git push <remote> stash[@{n}]:<branch>" to share a stash somewhere?
> > - And then, doesn't "git stash apply [--index] <arbitrary sha>" work?
> > (At which point you could presumably create a new stash, though I'll
> > admit that's cumbersome relative to dedicated export/import.)
>
> I haven't tried, but it does certainly seem plausible that you can
> import and export them in that way.
>
> > I can see how that doesn't help you quickly export a whole _chain_ of
> > stashes, so I'm not saying "this series seems like the wrong tack"
> > (far be it from me, who doesn't understand your use case, to say
> > that!). Rather, I'm confused about the inability to move a (single)
> > stash across machines.
>
> Let me explain the intended use case here.  At work, many people use
> GitHub Codespaces, which are throwaway development environments.  Since
> one's whole set of stashes cannot be imported or exported, it's hard to
> use stashes effectively in such a case, since they'd be deleted when you
> destroyed the environment.  I like stashes a lot (my personal Git
> development repository has 153), so I want to synchronize all of them
> across.
>
> The other case is people who routinely work on multiple machines.
> (Remote or throwaway development environments, like GitHub Codespaces or
> Devcontainers, are just a special case of this.)  Many of these users
> want to keep their working tree and other state across machines and lots
> of them rely on cloud syncing services, such as Dropbox, to do this,
> which often ends up corrupting the repository (as outlined in the FAQ).
> Providing a way to quickly and easily synchronize the working tree
> across systems, including any stashes, is really important to encourage
> best practices that don't result in data loss or have unpleasant
> security issues (such as untrusted local config).
>
> > Unrelated question: Can we import arbitrary refs into stashes? That
> > is, what happens if the commit structure doesn't look right? (Maybe I
> > should go read the tests and see.)
>
> That doesn't work because the commit used here has to have a fixed
> number of parents, since we need to keep track of the index and the
> working tree.  Stash commits, even the regular ones used in the reflog,
> always have to have a certain structure.
>
> If you try to do that anyway, you get this message:
>
>     % git stash import HEAD
>     error: 3bf235c35ef51d01663f2ab9665026b05b8af1dd is not a valid exported stash commit
>
> I did try to avoid people accidentally destroying data.
> --
> brian m. carlson (they/them)
> Toronto, Ontario, CA

You've answered all my questions, thanks!

-- 
D. Ben Knoble

  reply	other threads:[~2025-05-10 19:13 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-08 23:44 [PATCH v5 0/4] Importing and exporting stashes to refs brian m. carlson
2025-05-08 23:44 ` [PATCH v5 1/4] object-name: make get_oid quietly return an error brian m. carlson
2025-05-09  1:55   ` Junio C Hamano
2025-05-09 19:50     ` brian m. carlson
2025-05-08 23:44 ` [PATCH v5 2/4] builtin/stash: factor out revision parsing into a function brian m. carlson
2025-05-09 15:27   ` Junio C Hamano
2025-05-08 23:44 ` [PATCH v5 3/4] builtin/stash: provide a way to export stashes to a ref brian m. carlson
2025-05-09 16:38   ` Junio C Hamano
2025-05-09 19:31   ` Junio C Hamano
2025-05-10 21:24   ` Jeff King
2025-05-12  9:10   ` Phillip Wood
2025-05-12 15:53     ` Junio C Hamano
2025-05-08 23:44 ` [PATCH v5 4/4] builtin/stash: provide a way to import stashes from " brian m. carlson
2025-05-09 19:54   ` Junio C Hamano
2025-05-11 23:44     ` brian m. carlson
2025-05-10 17:21   ` Jeff King
2025-05-12 12:42     ` Junio C Hamano
2025-05-12 12:58       ` Jeff King
2025-05-12 16:05         ` Junio C Hamano
2025-05-12 21:19     ` brian m. carlson
2025-05-10 21:33   ` Jeff King
2025-05-12  9:10   ` Phillip Wood
2025-05-09  1:10 ` [PATCH v5 0/4] Importing and exporting stashes to refs Junio C Hamano
2025-05-09 20:16   ` brian m. carlson
2025-05-09 16:53 ` D. Ben Knoble
2025-05-09 20:15   ` brian m. carlson
2025-05-10 19:13     ` D. Ben Knoble [this message]
2025-05-22 18:55 ` [PATCH] Makefile: avoid constant rebuilds with compilation database brian m. carlson
2025-05-22 18:55   ` [PATCH v6 0/5] Importing and exporting stashes to refs brian m. carlson
2025-06-01 22:32     ` [PATCH v7 0/4] " brian m. carlson
2025-06-01 22:32       ` [PATCH v7 1/4] object-name: make get_oid quietly return an error brian m. carlson
2025-06-01 22:32       ` [PATCH v7 2/4] builtin/stash: factor out revision parsing into a function brian m. carlson
2025-06-01 22:32       ` [PATCH v7 3/4] builtin/stash: provide a way to export stashes to a ref brian m. carlson
2025-06-05  9:25         ` Phillip Wood
2025-06-11 11:31         ` Kristoffer Haugsbakk
2025-06-11 23:35           ` brian m. carlson
2025-06-01 22:32       ` [PATCH v7 4/4] builtin/stash: provide a way to import stashes from " brian m. carlson
2025-06-05  9:38       ` [PATCH v7 0/4] Importing and exporting stashes to refs Phillip Wood
2025-06-12  1:12       ` [PATCH v8 " brian m. carlson
2025-06-12  1:12         ` [PATCH v8 1/4] object-name: make get_oid quietly return an error brian m. carlson
2025-06-12  1:12         ` [PATCH v8 2/4] builtin/stash: factor out revision parsing into a function brian m. carlson
2025-06-12  1:12         ` [PATCH v8 3/4] builtin/stash: provide a way to export stashes to a ref brian m. carlson
2025-06-12  1:12         ` [PATCH v8 4/4] builtin/stash: provide a way to import stashes from " brian m. carlson
2025-06-25  8:40         ` [PATCH v8 0/4] Importing and exporting stashes to refs Phillip Wood
2025-06-25 16:30           ` Junio C Hamano
2025-05-22 18:55   ` [PATCH v6 1/5] object-name: make get_oid quietly return an error brian m. carlson
2025-05-22 19:27     ` Junio C Hamano
2025-05-22 18:55   ` [PATCH v6 2/5] reflog-walk: expose read_complete_reflog brian m. carlson
2025-05-22 21:53     ` Ramsay Jones
2025-05-23 23:22       ` brian m. carlson
2025-05-24  1:09         ` Ramsay Jones
2025-05-26 19:55           ` brian m. carlson
2025-05-29 16:01     ` Phillip Wood
2025-05-29 21:59       ` Junio C Hamano
2025-05-22 18:55   ` [PATCH v6 3/5] builtin/stash: factor out revision parsing into a function brian m. carlson
2025-05-22 20:34     ` Junio C Hamano
2025-05-23 23:25       ` brian m. carlson
2025-05-24  0:23         ` Junio C Hamano
2025-05-26 19:36           ` brian m. carlson
2025-05-22 18:55   ` [PATCH v6 4/5] builtin/stash: provide a way to export stashes to a ref brian m. carlson
2025-05-22 20:51     ` Junio C Hamano
2025-05-26 19:42       ` brian m. carlson
2025-05-29 16:01     ` Phillip Wood
2025-05-22 18:55   ` [PATCH v6 5/5] builtin/stash: provide a way to import stashes from " brian m. carlson
2025-05-22 21:09     ` Junio C Hamano
2025-05-26 20:03       ` brian m. carlson
2025-05-22 21:15     ` Junio C Hamano
2025-05-23 13:17       ` Phillip Wood
2025-05-22 19:00   ` [PATCH] Makefile: avoid constant rebuilds with compilation database brian m. carlson
2025-05-22 19:08     ` Junio C Hamano
2025-06-11 11:35 ` [PATCH v5 0/4] Importing and exporting stashes to refs Kristoffer Haugsbakk
2025-06-12  0:45   ` brian m. carlson

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='CALnO6CAeVzh0OhjD8CkXKEydP4SNkCODfmirMYvzG8xEYXPA=Q@mail.gmail.com' \
    --to=ben.knoble@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=phillip.wood123@gmail.com \
    --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).