是否可以将git stash推送到远程存储库?

在git中,是否可以创建存储,将存储推到远程存储库,在另一台计算机上检索存储,然后应用存储?

还是我的选择:

  • 创建补丁并将补丁复制到另一台计算机,或者

  • 创建一个次要分支并将未完成的工作提交给该分支?


呼唤远方
浏览 1213回答 3
3回答

蝴蝶不菲

无法通过fetch或类似方式获取它,镜像refspec是fetch = +refs/*:refs/*,即使隐藏,refs/stash它也不会发送。显式refs/stash:refs/stash也不起作用!无论如何,这只会令人困惑,因为那不会获取所有存储,只有最新存储。存放清单是ref 的reflogrefs/stashes。

阿晨1998

注意:我刚刚用24小时的git-fu重写了这个答案:)在我的shell历史中,整个shebang现在是三个单线。但是,为方便起见,我将它们简化了。这样,我希望您能够看到我的工作方式,而不必盲目地复制/粘贴内容。这是逐步的。假定〜/ OLDREPO中包含隐藏项的源。创建一个不包含存储的TEST克隆:cd ~/OLDREPOgit clone . /tmp/TEST将所有存储卡推送为临时分支:git send-pack /tmp/TEST $(for sha in $(git rev-list -g stash); \    do echo $sha:refs/heads/stash_$sha; done)在接收端循环,以变回隐藏处:cd /tmp/TEST/for a in $(git rev-list --no-walk --glob='refs/heads/stash_*'); do     git checkout $a &&     git reset HEAD^ &&     git stash save "$(git log --format='%s' -1 HEAD@{1})"done清理临时分支机构git branch -D $(git branch|cut -c3-|grep ^stash_)做一个git stash列表,您将像这样:stash@{0}: On (no branch): On testing: openmp importstash@{1}: On (no branch): On testing: zfsrcstash@{2}: On (no branch): WIP on sehe: 7006283 fixed wrong path to binary in debianized init script (reported as part of issuestash@{3}: On (no branch): WIP on debian-collab: c5c8037 zfs_pool_alert should be installed by defaultstash@{4}: On (no branch): WIP on xattrs: 3972694 removed braindead leftover -O0 flagstash@{5}: On (no branch): WIP on testing: 3972694 removed braindead leftover -O0 flagstash@{6}: On (no branch): WIP on testing: db9f77e fuse_unmount_all could be starved for the mtx lockstash@{7}: On (no branch): WIP on xattrs: db9f77e fuse_unmount_all could be starved for the mtx lockstash@{8}: On (no branch): WIP on testing: 28716d4 fixed implicit declaration of stat64stash@{9}: On (no branch): WIP on emmanuel: bee6660 avoid unrelated changes在原始存储库上,看起来像stash@{0}: WIP on emmanuel: bee6660 avoid unrelated changesstash@{1}: WIP on testing: 28716d4 fixed implicit declaration of stat64stash@{2}: WIP on xattrs: db9f77e fuse_unmount_all could be starved for the mtx lockstash@{3}: WIP on testing: db9f77e fuse_unmount_all could be starved for the mtx lockstash@{4}: WIP on testing: 3972694 removed braindead leftover -O0 flagstash@{5}: WIP on xattrs: 3972694 removed braindead leftover -O0 flagstash@{6}: WIP on debian-collab: c5c8037 zfs_pool_alert should be installed by defaultstash@{7}: WIP on sehe: 7006283 fixed wrong path to binary in debianized init script (reported as part of issue #57)stash@{8}: On testing: zfsrcstash@{9}: On testing: openmp import
打开App,查看更多内容
随时随地看视频慕课网APP