git clone -b template https://github.com/iview/iview-admin.git //clone template分支
-b 后方的 template 是新建文件夹的名字
克隆多个分支 cd iview_project //切换到指定目录git clone https://github.com/iview/iview-admin.git //克隆项目
cd iview-admin //切换到项目目录git branch -a //列出所有分支名称如下: * 号表示当前分支* dev remotes/origin/HEAD -> origin/devremotes/origin/desktopremotes/origin/devremotes/origin/gh-pagesremotes/origin/masterremotes/origin/template
origin/template, origin是远程仓库名,template是远程仓库的一个分之,由上结果可以看出,远程仓库origin还有desktop、dev、gh-pages、template、master等分支。
接下来,可以在本地新建分支并与远程仓库的分支进行关联了
git checkout -b template origin/template // 作用是checkout远程仓库origin的分支template,在本地起名为template分支,并切换到本地的template分支 git checkout -b desktop origin/desktop // 作用参见上一步解释
git checkout dev // 切换回dev分支,并开始开发。
git branch -a //查看所有分支git branch -r //查看远程分支