如何克隆远程 Git 代码仓库的所有分支?
Git clone 默认只能克隆远程代码仓库的 master 分支。
如何克隆远程代码仓库里面的所有分支?下面是我整理的方法,有效。

1. 打开 Git Bash。新建一个文件夹 temp: mkdir temp
2. cd temp
3. git clone --mirror http://remote-code-url/username/code.git
4. 此时,你会发现本地有了一个文件夹:code.git,将其重命名为 .git。 命令: mv code.git/ .git
5. git config --bool core.bare false
6. git reset --hard
7. 检查是否在本地已经有了所有的分支:git branch
网上的教程在最关键的第4步没有说清楚,导致第6步出现 fatal 错误。
参考:
1. https://tecadmin.net/clone-all-remote-branches-in-git-repository/
2. https://stackoverflow.com/questions/10312521/how-do-i-fetch-all-git-branches

