我可以从远程回购仓库取回一个本地分行吗? [英] Can I fetch a stash from a remote repo into a local branch?

查看:96
本文介绍了我可以从远程回购仓库取回一个本地分行吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

pre>
%git ls-remote〜alice / work / repo / stash
3ccc82fb1ee0e7bde1250c7926d333ce21c109c0 refs / stash



<但是当我试图获取它时,git告诉我无法找到3cc82 ...。

$ g $ f $〜$ b $ git fetch〜alice /工作/回购隐藏:new_branch
远程:共0(delta 0),重用0(delta 0)
错误:无法找到3ccc82fb1ee0e7bde1250c7926d333ce21c109c0
致命:对象3ccc82fb1ee0e7bde1250c7926d333ce21c109c0找不到

有没有一种方法可以获取远程存储?

解决方案

更新:原始发布者问题的直接答案是:

  git send-pack ./ 3ccc82fb1ee0e7bde1250c7926d333ce21c109c0:refs / heads / tempbranch 



ch'将来自远程的最新存储(存储@ {0})。不幸的是,我不认为reflog是从远程分支获取的,所以除非您有权访问源代码回购,否则无法获取其他的存储。



编写脚本:我在上述问题上发布了一个更全面的'脚本'解决方案



另外,正如我在此期间发现的那样,如果您有权访问源代码回购,git-send-pack可以是有用的:

  git send-pack ../myworkingfolder/ stash @ {0}:refs / heads / collegue_stash 


A colleague has a stash in their repository which I can access (via the filesystem), and I'd like to pull that stash into a branch in my repository.

% git ls-remote ~alice/work/repo/ stash
3ccc82fb1ee0e7bde1250c7926d333ce21c109c0        refs/stash

But when I try to fetch that, git tells me "unable to find 3cc82..."

% git fetch ~alice/work/repo stash:new_branch
remote: Total 0 (delta 0), reused 0 (delta 0)
error: unable to find 3ccc82fb1ee0e7bde1250c7926d333ce21c109c0
fatal: object 3ccc82fb1ee0e7bde1250c7926d333ce21c109c0 not found

Is there a way I can fetch the remote stash?

解决方案

Update: A direct answer to the original poster's question is:

git send-pack ./ 3ccc82fb1ee0e7bde1250c7926d333ce21c109c0:refs/heads/tempbranch

'tempbranch' will be at the latest stash (stash@{0}) from the remote. Unfortunately I don't think the reflog is fetched from remote branches, so there is no way to get at the other stashes, unless you have access to the source repo.

Scripting it: I posted a more comprehensive 'scripted' solution over at the mentioned question

Is it possible to push a git stash to a remote repository?

Also, as I discovered in the meantime, git-send-pack can be instrumental if you have access to the source repo:

git send-pack ../myworkingfolder/ stash@{0}:refs/heads/collegue_stash

这篇关于我可以从远程回购仓库取回一个本地分行吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆