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