git命令-切換分支
阿新 • • 發佈:2018-04-13
gin patch AC clone pat head ast span IT
git一般有很多分支,我們clone到本地的時候一般都是master分支,那麽如何切換到其他分支呢?
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/v0.9rc1
2. 查看本地分支
~/mxnet$ git branch
* master
3. 切換分支
$ git checkout -b v0.9rc1 origin/v0.9rc1
Branch v0.9rc1 set up to track remote branch v0.9rc1 from origin.
Switched to a new branch ‘v0.9rc1‘
#已經切換到v0.9rc1分支了
$ git branch
master
* v0.9rc1
#切換回master分支
$ git checkout master
Switched to branch ‘master‘
Your branch is up-to-date with ‘origin/master‘.
git命令-切換分支