iOS企业级开发实用技术

git命令切换分支

2019-04-15  本文已影响2人  强强刘

Git一般有很多分支,我们clone到本地的时候一般都是master分支.

1. 查看本地及远程分支
$ git branch -a 
我在mxnet根目录下运行以上命令:
$ git branch -a
* English
  master
  remotes/origin/English
  remotes/origin/document
  remotes/origin/master

很明显当前我们在master分支

2. 查看本地分支
$ git branch
* English
  master
  remotes/origin/English
  remotes/origin/master
2. 查看远程分支
$ git branch -r
* English
  master
  remotes/origin/English
  remotes/origin/document
  remotes/origin/master
3. 切换分支
$ git checkout -b English origin/English
Branch English set up to track remote branch English from origin.
Switched to a new branch 'English'
3. 切换会主干
$ git checkout master
$ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
上一篇下一篇

猜你喜欢

热点阅读