git【clone 指定的分支代码】

git初始化一般是这样。

git init 

git clone [remote repository address (.git地址)]

之后重点来了,因为clone下来的一般为master分支,有可能不是想拉下来的分支。可以使用以下的方法

git branch -a 先查看当前远端分支情况

git  checkout origin/<branch name>  选择远端name分支

git branch <branch name> 创建本地name分支

git branch 查看本地分支情况

git checkout <branch name>  选择本地已创建的分支就可以了


直接指定clone某个分支:

git clone -b <branch name> [remote repository address]    

栗子[clone dubbo master branch code]:git clone -b master https://github.com/apache/incubator-dubbo.git




猜你喜欢

转载自blog.csdn.net/fenglongmiao/article/details/80833213