RE: [feature suggestion] Add 'git stash export', 'git stash import' commands to allow to backup stash externally
From: Randall S. Becker <hidden>
Date: 2021-05-05 20:07:59
On May 5, 2021 3:52 PM, Yuri wrote:
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