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

Re: [feature suggestion] Add 'git stash export', 'git stash import' commands to allow to backup stash externally

From
Junio C Hamano <gitster@pobox.com>
Date
May 6, 2021, 02:22 UTC
Message-ID
<xmqq1rak1tz3.fsf@gitster.g>
In-Reply-To
<000401d741ea$5227c610$f6775230$@nexbridge.com>
"Randall S. Becker" <rsbecker@nexbridge.com> writes:
Show 6 quoted lines
> I would like to suggest another option: Teach clone and fetch to
> transfer stash commits. They are filtered out normally. It might
> be straightforward to preserve the stashed commits. A mirror
> approach is probably not appropriate since that needs the repo to
> be bare and Yuri's situation is unlikely to support that. So
> something like --include-stashes, which would be off by default.

It would unfortunately not work, since stash is not implemented as a set of regular refs. Instead its entries are kept in reflogs. And because the reflog is treated as an entierly local matter, reflog entries are not transfered across fetches and clones.

If stash are redesigned so that each of its entry becomes a separate ref (e.g. refs/stash/0 refs/stash/1 refs/stash/2 ...), then

    git bundle stash.bndl $(git for-each-ref --format='%(refname)' refs/stash/\*)

might become the beginning of a viable implementation of "stash export" (but note that the above does not list any stopping point of the history traversal, so it is just the beginning and does not make a practical solution).

Previous: YuriNext: Johannes Sixt
Message 4 of 16 in “[feature suggestion] Add 'git stash export', 'git stash import' commands to allow to backup stash externally”
  1. YuriMay 5, 2021
  2. Randall S. BeckerMay 5, 2021
  3. YuriMay 5, 2021
  4. Junio C HamanoMay 6, 2021
  5. Johannes SixtMay 6, 2021
  6. YuriMay 6, 2021
  7. Johannes SixtMay 6, 2021
  8. YuriMay 6, 2021
  9. Junio C HamanoMay 6, 2021
  10. YuriMay 6, 2021
  11. Junio C HamanoMay 6, 2021
  12. Felipe ContrerasMay 6, 2021
  13. Felipe ContrerasMay 6, 2021
  14. YuriMay 6, 2021
  15. Felipe ContrerasMay 6, 2021
  16. Theodore Ts'oMay 6, 2021

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.