与“git push --mirror”相反?我如何取回我的回购协议?
我使用 git push --mirror 取得了巨大成功,将备份副本复制到裸存储库。但是在搜索 SO 和其他地方之后,我找不到使用所有分支在本地克隆该东西的方法。我不想使用git clone
,因为我不想我的本地存储库了解裸存储库。如果我使用 git pull ,它只会拉下 HEAD 分支。
猜测:
git pull /data/Dropbox/backup/that_stuff.git *
当然,我无处可去。
如何再次获取包含所有分支的整个存储库?我意识到我可能可以将裸存储库复制到我的 .git 目录,但这似乎是一个坏主意。
I am having great success with git push --mirror
to make backup copies to a bare repo. But after search on SO and elsewhere, I cannot find a way to clone the thing locally with all branches. I do not want to use git clone
since I don't want my local repo to know about the bare repo. If I use git pull
it only brings down the HEAD branch.
Guessing:
git pull /data/Dropbox/backup/that_stuff.git *
gets me nowhere, of course.
How do I get the entire repo with all branches back again? I realize I could probably just copy the bare repo to my .git directory, but that seems like a bad idea.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试
git fetch
而不是git pull
因为
git pull
是用来获取分支并将其合并到本地分支的,所以它不会尝试将所有远程分支合并到本地分支很有意义。上述命令从远程 refs/heads/ 命名空间复制所有分支并将它们存储到本地 refs/remotes/remoteRpo/ 命名空间,除非
branch..fetch
选项用于指定非默认引用规范。。尝试:
可以强制获取所有分支的所有头。
请参阅这个SO问题。
OP yar 报告:
有效。
Try
git fetch
instead ofgit pull
Since
git pull
is there to fetch a branch and merge it to a local branch, it wouldn't make alot of sense trying to merge all remote branches to a local branches.The above command copies all branches from the remote
refs/heads/
namespace and stores them to the localrefs/remotes/remoteRpo/
namespace, unless thebranch.<name>.fetch
option is used to specify a non-default refspec..Try:
could force fetching all heads for all branches.
See this SO question.
The OP yar reports:
works.
还有(现在?) git clone --mirror。但男人说:
https://git.wiki.kernel.org/index .php/GitFaq#How_do_I_clone_a_repository_with_all_remotely_tracked_branches.3F 描述了如何将裸仓库变成非裸仓库。
There's also (now?) git clone --mirror. But man says:
https://git.wiki.kernel.org/index.php/GitFaq#How_do_I_clone_a_repository_with_all_remotely_tracked_branches.3F describes how to turn bare repo into non-bare.
您可以使用 git-copy 来实现此目的。
You can achieve this with git-copy.