当前位置:   article > 正文

git命令-切换分支_switched to a new branch 'detail-banner' branch 'd

switched to a new branch 'detail-banner' branch 'detail-banner' set up to tr

Git一般有很多分支,我们clone到本地的时候一般都是master分支,那么如何切换到其他分支呢?主要命令如下:

1. 查看远程分支

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

  1. ~/mxnet$ git branch -a
  2. * master
  3. remotes/origin/HEAD -> origin/master
  4. remotes/origin/master
  5. remotes/origin/nnvm
  6. remotes/origin/piiswrong-patch-1
  7. remotes/origin/v0.9rc1
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

可以看到,我们现在在master分支下

2. 查看本地分支

  1. ~/mxnet$ git branch
  2. * master
  • 1
  • 2
  • 1
  • 2

3. 切换分支

  1. $ git checkout -b v0.9rc1 origin/v0.9rc1
  2. Branch v0.9rc1 set up to track remote branch v0.9rc1 from origin.
  3. Switched to a new branch 'v0.9rc1'
  4. #已经切换到v0.9rc1分支了
  5. $ git branch
  6. master
  7. * v0.9rc1
  8. #切换回master分支
  9. $ git checkout master
  10. Switched to branch 'master'
  11. Your branch is up-to-date with 'origin/master'.
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/羊村懒王/article/detail/704784
推荐阅读
相关标签
  

闽ICP备14008679号