git clone 指定分支 /git checkout -b 本地分支名 origin/指定远程分支名

将远程git仓库里的指定分支拉取到本地(本地不存在的分支)

方法一:

git checkout -b 本地分支名 origin/远程分支名

方法二:用克隆法
git clone -b 指定的远程分支名 GitHub-URL

git clone -b ieo https://github.com/iht-dev/Exchange-API-Services.git

Last login: Fri Apr 12 17:45:30 on ttys009
bogon:ieo david$ pwd
/Users/david/idea-workspace/ieo
bogon:ieo david$ git clone -b ieo https://github.com/iht-dev/Exchange-API-Services.git
Cloning into 'Exchange-API-Services'...
remote: Enumerating objects: 37, done.
remote: Counting objects: 100% (37/37), done.
remote: Compressing objects: 100% (17/17), done.
remote: Total 27005 (delta 10), reused 30 (delta 8), pack-reused 26968
Receiving objects: 100% (27005/27005), 4.53 MiB | 49.00 KiB/s, done.
Resolving deltas: 100% (15899/15899), done.
bogon:ieo david$ 

bogon:ieo david$ ls
Exchange-API-Services
bogon:ieo david$ 

bogon:ieo david$ ls
Exchange-API-Services
bogon:ieo david$ 
bogon:ieo david$ mv Exchange-API-Services Exchange-API-Services-IEO
bogon:ieo david$ cd Exchange-API-Services-IEO/
bogon:Exchange-API-Services-IEO david$ git branch
* ieo
bogon:Exchange-API-Services-IEO david$ git branch -vv
* ieo 23b496b1 [origin/ieo] update
bogon:Exchange-API-Services-IEO david$ 


你可能感兴趣的:(git clone 指定分支 /git checkout -b 本地分支名 origin/指定远程分支名)