View git branch switch

Git Generally there are many branches, we clone to local time usually master branch, then how to switch to other branches of it? The main command is as follows:

1. Check the remote branch

$ git branch -a 
I run the above command in mxnet root directory:

~/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

You can see, we are now in the master branch under

2. Check local branch

~/mxnet$ git branch
* master

3. branch switching

$ 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'.

Guess you like

Origin www.cnblogs.com/hnhycnlc888/p/11456752.html