“git push --mirror”的对面?我如何取回我的回购? [英] Opposite of `git push --mirror`? How do I get my repo back?
问题描述
使用 git push --mirror
获得巨大成功,可以将备份副本制作成裸露的回购。但是在SO和其他地方搜索后,我无法找到一种方法来在本地克隆所有分支。我不想使用 git clone
因为我不希望我的本地回购了解裸回购。如果我使用 git pull
,它只会关闭HEAD分支。
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 *
当然,我无处可去。
我如何获得所有分支的整个回购?我意识到我可能只是将裸回购复制到我的.git目录,但这似乎是一个坏主意。 / p>
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.
推荐答案
试试 git fetch
而不是 git pull
由于 git 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.
$ git fetch a-repo_url
上述命令复制远程 refs / heads /
命名空间并将它们存储到本地 refs / remotes / remoteRpo /
命名空间,除非分支。< name> .fetch
选项是用于指定非默认的refspec。。
Try:
The above command copies all branches from the remote refs/heads/
namespace and stores them to the local refs/remotes/remoteRpo/
namespace, unless the branch.<name>.fetch
option is used to specify a non-default refspec..
Try:
$ git fetch a-repo-url +refs/heads/*:refs/heads/*
负责所有分支机构。
查看此 SO问题 a>。
could force fetching all heads for all branches.
See this SO question.
OP yar 报告:
git pull /data/Dropbox/backup/mjdj.git/ +refs/heads/*:refs/heads/*
的作品。
这篇关于“git push --mirror”的对面?我如何取回我的回购?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!