Git命令 分支切换

  1. 查看远程分支

$ git branch -a
我在mxnet根目录下运行以上命令:

~/mxnet$ git branch -a

  • master
    remotes/origin/HEAD -> origin/master
    remotes/origin/master
    remotes/origin/nnvm
    remotes/origin/piiswrong-patch-1
    remotes/origin/test001
    可以看到,我们现在在master分支下
  1. 查看本地分支

~/mxnet$ git branch

  • master
  1. 切换分支

$ git checkout -b test001 origin/test001
Branch test001 set up to track remote branch test001 from origin.
Switched to a new branch ‘test001’

#已经切换到test001分支了
$ git branch
master

  • test001

#切换回master分支
$ git checkout master
Switched to branch ‘master’
Your branch is up-to-date with ‘origin/master’.

发表评论

电子邮件地址不会被公开。 必填项已用*标注