为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

Git
呼唤远方 2019-10-05 15:15:35
在git中,是否可以创建存储,将存储推到远程存储库,在另一台计算机上检索存储,然后应用存储?还是我的选择:创建补丁并将补丁复制到另一台计算机,或者创建一个次要分支并将未完成的工作提交给该分支?
查看完整描述

3 回答

?
蝴蝶不菲

TA贡献1810条经验 获得超4个赞

无法通过fetch或类似方式获取它,镜像refspec是fetch = +refs/*:refs/*,即使隐藏,refs/stash它也不会发送。显式refs/stash:refs/stash也不起作用!

无论如何,这只会令人困惑,因为那不会获取所有存储,只有最新存储。存放清单是ref 的reflogrefs/stashes


查看完整回答
反对 回复 2019-10-05
?
阿晨1998

TA贡献2037条经验 获得超6个赞

注意:我刚刚用24小时的git-fu重写了这个答案:)在我的shell历史中,整个shebang现在是三个单线。但是,为方便起见,我将它们简化了。


这样,我希望您能够看到我的工作方式,而不必盲目地复制/粘贴内容。


这是逐步的。


假定〜/ OLDREPO中包含隐藏项的源。创建一个不包含存储的TEST克隆:


cd ~/OLDREPO

git 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 import

stash@{1}: On (no branch): On testing: zfsrc

stash@{2}: On (no branch): WIP on sehe: 7006283 fixed wrong path to binary in debianized init script (reported as part of issue

stash@{3}: On (no branch): WIP on debian-collab: c5c8037 zfs_pool_alert should be installed by default

stash@{4}: On (no branch): WIP on xattrs: 3972694 removed braindead leftover -O0 flag

stash@{5}: On (no branch): WIP on testing: 3972694 removed braindead leftover -O0 flag

stash@{6}: On (no branch): WIP on testing: db9f77e fuse_unmount_all could be starved for the mtx lock

stash@{7}: On (no branch): WIP on xattrs: db9f77e fuse_unmount_all could be starved for the mtx lock

stash@{8}: On (no branch): WIP on testing: 28716d4 fixed implicit declaration of stat64

stash@{9}: On (no branch): WIP on emmanuel: bee6660 avoid unrelated changes

在原始存储库上,看起来像


stash@{0}: WIP on emmanuel: bee6660 avoid unrelated changes

stash@{1}: WIP on testing: 28716d4 fixed implicit declaration of stat64

stash@{2}: WIP on xattrs: db9f77e fuse_unmount_all could be starved for the mtx lock

stash@{3}: WIP on testing: db9f77e fuse_unmount_all could be starved for the mtx lock

stash@{4}: WIP on testing: 3972694 removed braindead leftover -O0 flag

stash@{5}: WIP on xattrs: 3972694 removed braindead leftover -O0 flag

stash@{6}: WIP on debian-collab: c5c8037 zfs_pool_alert should be installed by default

stash@{7}: WIP on sehe: 7006283 fixed wrong path to binary in debianized init script (reported as part of issue #57)

stash@{8}: On testing: zfsrc

stash@{9}: On testing: openmp import


查看完整回答
反对 回复 2019-10-05
  • 3 回答
  • 0 关注
  • 1208 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信