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
Randall S. Becker <rsbecker@nexbridge.com>
Date
May 5, 2021, 20:07 UTC
Message-ID
<000401d741ea$5227c610$f6775230$@nexbridge.com>
In-Reply-To
<d8aef355-0718-8b3d-7e9f-614673dd250f@rawbw.com>
On May 5, 2021 3:52 PM, Yuri wrote:
Show 14 quoted lines
>Subject: [feature suggestion] Add 'git stash export', 'git stash import' commands
>to allow to backup stash externally
>
>I work in a very large repository, but all of it except for my stashed items can be
>re-downloaded from the remote URL.
>
>
>Stash though is much smaller in size and is especially valuable. Its
>loss would be very expensive.
>
>
>Could you please consider adding 'git stash export', 'git stash import'
>commands so that in case of an accidental repository loss stash can be
>imported from the external backup?
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.
As a side potential defect/bug, if you fetch refs/stash, git is happy to comply and reports the HEAD update and then loses it. git show-refs does not show the stash. What I saw on the fetch was (I only had untracked files in my stash to make things more painful) as follows in 2.29.1:
$ git fetch origin refs/stash
From /path-to-repo
 * branch              refs/stash -> FETCH_HEAD
-Randall
Previous: YuriNext: Yuri
Message 2 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.