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

I have great success with git push --mirror to make backups unfilled with repos. But after searching in SO and elsewhere, I cannot find a way to localize locally using all branches. I do not want to use git clone , since I do not want my local repo to know about the bare repo. If I use git pull , it only drops the HEAD branch.

Divination:

 git pull /data/Dropbox/backup/that_stuff.git * 

I’m not going anywhere, of course.

How to get a complete repo with all branches back? I understand that maybe I would just copy the bare repo to my .git directory, but that seems like a bad idea.

+6
git pull
source share
3 answers

Try git fetch instead of git pull

Since git pull exists to extract a branch and merge it into a local branch, it will not try to merge all remote branches into local branches.

 $ git fetch a-repo_url 

The above command copies all branches from the remote namespace refs/heads/ and saves them in the local namespace refs/remotes/remoteRpo/ , if the branch.<name>.fetch not used to specify a non-default reflex. .
Try:

 $ git fetch a-repo-url +refs/heads/*:refs/heads/* 

can force a selection of all heads for all branches.
See This SO Question .


OP yar report:

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

work.

+2
source share

There also (now?) Git clone --mirror. But the 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 a bare repo into a non-bare one.

+1
source share

You can achieve this with git-copy .

 git copy /data/Dropbox/backup/that_stuff.git that_stuff.git 
-one
source share

All Articles