比如现在在master上
要查看所有分支情况:git branch -a
会包括本地分支或远端分支
*master
remotes/origin/A
现在远端已经创建好了A分支
本地只要:git checkout -b A_local remotes/origin/A 就可以了
然后,git checkout A_local, git pull 就可以了
其实还可以更简单:
git checkout A 就可以了,这样git会本地自动创建远端remotes/origin/A对应的本地分支A
git branch -a查看如下:
master
*A
remotes/origin/A
其实:git checkout -b A_local remotes/origin/A 如果拆分开的话是这样的:
git branch A_local
git branch --track A_local remotes/origin/A
git checkout A_local