How to clone all remote branches in Git?

后端 未结 30 2107
情话喂你
情话喂你 2020-11-22 01:08

I have a master and a development branch, both pushed to GitHub. I\'ve cloned, pulled, and fetched, but I re

30条回答
  •  孤独总比滥情好
    2020-11-22 01:29

    Better late than never, but here is the best way to do this:

    mkdir repo
    cd repo
    git clone --bare path/to/repo.git .git
    git config --unset core.bare
    git reset --hard
    

    At this point you have a complete copy of the remote repo with all of it's branches (verify with git branch). You can use --mirror instead of --bare if your remote repo has remotes of its own.

提交回复
热议问题