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 查看本地分支

1 $ git branch
2  
3 * br-2.1.2.2
4  
5 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

 

 1 shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (br-2.1.2.2)
 2  
 3 $ git branch
 4  
 5 * br-2.1.2.2
 6  
 7 master
 8  
 9 test
10  
11 shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (br-2.1.2.2)
12  
13 $ git checkout test
14  
15 M jingwei-server/src/main/java/com/taobao/jingwei/server/service/cmd/GetCustomerTarCmd.java
16  
17 M jingwei-server/src/main/java/com/taobao/jingwei/server/util/ServerUtil.java
18  
19 Switched to branch 'test'
20  
21 shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (test)
22  
23 $ git branch
24  
25 br-2.1.2.2
26  
27 master
28  
29 * test

 

5 删除本地分支   git branch -d xxxxx

 1 $ git checkout br-2.1.2.2
 2  
 3 M jingwei-server/src/main/java/com/taobao/jingwei/server/service/cmd/GetCustomerTarCmd.java
 4  
 5 M jingwei-server/src/main/java/com/taobao/jingwei/server/util/ServerUtil.java
 6  
 7 Switched to branch 'br-2.1.2.2'
 8  
 9 shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (br-2.1.2.2)
10  
11 $ git br
12  
13 * br-2.1.2.2
14  
15 master
16  
17 test
18  
19 shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (br-2.1.2.2)
20  
21 $ git br -d test
22  
23 Deleted branch test (was 17d28d9).
24  
25 shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (br-2.1.2.2)
26  
27 $ git br
28  
29 * br-2.1.2.2
30  
31 master

6 查看本地和远程分支  -a。前面带*号的代表你当前工作目录所处的分支

 1 shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (test)
 2  
 3 $ git branch -a
 4  
 5 br-2.1.2.2
 6  
 7 master
 8  
 9 * test
10  
11 remotes/origin/HEAD -> origin/master
12  
13 remotes/origin/br-2.1.2.1
14  
15 remotes/origin/br-2.1.2.2
16  
17 remotes/origin/br-2.1.3
18  
19 remotes/origin/master

本文永久地址:http://blog.it985.com/753.html
本文出自 IT985博客 ,转载时请注明出处及相应链接。

 

 

 

 

posted on 2016-11-23 17:48  拉斐1982  阅读(241)  评论(0编辑  收藏  举报