Opposite of `git push --mirror`? How do I get my repo back?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 07:47:48
VonC

Try git fetch instead of 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

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/*

could force fetching all heads for all branches.
See this SO question.


The OP yar reports:

git pull /data/Dropbox/backup/mjdj.git/ +refs/heads/*:refs/heads/*

works.

There's also (now?) git clone --mirror. But man says:

   --mirror
       Set up a mirror of the remote repository. This implies --bare.

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.

You can achieve this with git-copy.

git copy /data/Dropbox/backup/that_stuff.git that_stuff.git
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!