git命令 branch 切换远程分支Github

git branch

git branch 不带参数:列出本地已经存在的分支,并且在当前分支的前面加“*”号标记,例如:
git branch -r 列出远程分支,例如:
git branch -a 列出本地分支和远程分支。
git branch branchname 创建分支
git checkout branchname 切换分支

举个例子:
https://github.com/googlesamples/android-architecture
Google todo mvp 里面有一堆分支 其中master分支没有todo源码
git命令 branch 切换远程分支Github_第1张图片

想查看关心分支的具体步骤:
1.git clone https://github.com/googlesamples/android-architecture.git
将代码down下来
2、查看分支信息

tp@DESKTOP-PH3N4FA MINGW64 /e/github/android-architecture/android-architecture (todo-databinding)
$ git branch
  master
* todo-databinding
  todo-mvp-rxjava

tp@DESKTOP-PH3N4FA MINGW64 /e/github/android-architecture/android-architecture (todo-databinding)
$ git branch -r
  origin/HEAD -> origin/master
  origin/dev-todo-mvp-clean-fix-memory-leak
  origin/dev-todo-mvp-tablet
  origin/dev-todo-mvp-tablet_dialogfragment
  origin/master
  origin/todo-databinding
  origin/todo-mvp
  origin/todo-mvp-clean
  origin/todo-mvp-contentproviders
  origin/todo-mvp-dagger
  origin/todo-mvp-loaders
  origin/todo-mvp-rxjava

3、切换分支
切换成功后(todo-mvp):将会发生改变

tp@DESKTOP-PH3N4FA MINGW64 /e/github/android-architecture/android-architecture (todo-databinding)
$ git checkout todo-mvp
Branch todo-mvp set up to track remote branch todo-mvp from origin.
Switched to a new branch 'todo-mvp'

tp@DESKTOP-PH3N4FA MINGW64 /e/github/android-architecture/android-architecture (todo-mvp)
$

你可能感兴趣的:(android,git)