首先通过git branch -a
来查看所在目录的分支
$ git branch -a
master
* trunk
remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/branch1
然后输入命令切换分支
$ git checkout -b branch1 origin/branch1
切换到origin/branch1
分支命令本地分支为branch1
首先通过git branch -a
来查看所在目录的分支
$ git branch -a
master
* trunk
remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/branch1
然后输入命令切换分支
$ git checkout -b branch1 origin/branch1
切换到origin/branch1
分支命令本地分支为branch1