方法一:
git clone只能clone远程库的master分支,无法clone所有分支,解决办法如下:
找一个干净目录,假设是git_work cd git_work git clone http://myrepo.xxx.com/project/.git ,这样在git_work目录下得到一个project子目录 cd project git branch -a,列出所有分支名称如下: remotes/origin/dev remotes/origin/release git checkout -b dev origin/dev,作用是checkout远程的dev分支,在本地起名为dev分支,并切换到本地的dev分支 git checkout -b release origin/release,作用参见上一步解释 git checkout dev,切换回dev分支,并开始开发。
作者:yuanchao99
来源:CSDN
原文:https://blog.csdn.net/yuanchao99/article/details/39118439
版权声明:本文为博主原创文章,转载请附上博文链接!
方法二:
git clone xxx git branch -r | grep -v '->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done git fetch --all git pull --all
来自Stackoverflow
链接:http://stackoverflow.com/questions/10312521/how-to-fetch-all-git-branches