方法一:
git clone只能clone远程库的master分支,无法clone所有分支,解决办法如下:
- 本地新建workspace目录
- cd workspace
- git clone git@IP地址:App/App.git,这样在workspace目录下得到一个App子目录
- cd App
- git branch -a,列出所有分支名称如下:
* master
remotes/origin/develop
remotes/origin/release
6. git checkout -b develop origin/develop 作用是checkout远程的devlop分支,在本地起名为develop分支,
并切换到本地的develop分支
7. git checkout -b release origin/release,作用参见上一步解释
8. git checkout develop,切换回develop分支
方法二:
git从远程仓库获取所有分支
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