1 查看远程分支
$ git branch -a
* br-2.1.2.2
master
remotes/origin/head -> origin/master
remotes/origin/br-2.1.2.1
remotes/origin/br-2.1.2.2
remotes/origin/br-2.1.3
remotes/origin/master
2 查看本地分支
$ git branch
* br-2.1.2.2
master
3 创建分支
shuohailhl@shuohailhl-pc /f/ggg/jingwei (br-2.1.2.2)
$ git branch test
$ git branch
* br-2.1.2.2
master
test
4 切换分支到test
shuohailhl@shuohailhl-pc /f/ggg/jingwei (br-2.1.2.2)
$ git branch
* br-2.1.2.2
master
test
shuohailhl@shuohailhl-pc /f/ggg/jingwei (br-2.1.2.2)
$ git checkout test
m jingwei-server/src/main/java/com/taobao/jingwei/server/service/cmd/getcustomertarcmd.java
m jingwei-server/src/main/java/com/taobao/jingwei/server/util/serverutil.java
switched to branch 'test'
shuohailhl@shuohailhl-pc /f/ggg/jingwei (test)
$ git branch
br-2.1.2.2
master
* test
5 删除本地分支 git branch -d xxxxx
$ git checkout br-2.1.2.2
m jingwei-server/src/main/java/com/taobao/jingwei/server/service/cmd/getcustomertarcmd.java
m jingwei-server/src/main/java/com/taobao/jingwei/server/util/serverutil.java
switched to branch 'br-2.1.2.2'
shuohailhl@shuohailhl-pc /f/ggg/jingwei (br-2.1.2.2)
$ git br
* br-2.1.2.2
master
test
shuohailhl@shuohailhl-pc /f/ggg/jingwei (br-2.1.2.2)
$ git br -d test
deleted branch test (was 17d28d9).
shuohailhl@shuohailhl-pc /f/ggg/jingwei (br-2.1.2.2)
$ git br
* br-2.1.2.2
master
6 查看本地和远程分支 -a。前面带*号的代表你当前工作目录所处的分支
shuohailhl@shuohailhl-pc /f/ggg/jingwei (test)
$ git branch -a
br-2.1.2.2
master
* test
remotes/origin/head -> origin/master
remotes/origin/br-2.1.2.1
remotes/origin/br-2.1.2.2
remotes/origin/br-2.1.3
remotes/origin/master