简介
上周五晚上,把最近几个爬虫push到leader那里时,老报冲突,原来我之前一直用的本地分支push到别的分支上了……学习了下Git
查看远程分支
1 2 3 4 5 6 7 8
| $ 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
|
查看本地分支
这个好像比较少用
1 2 3 4
| shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (br-2.1.2.2) $ git branch * br-2.1.2.2 master
|
创建分支
1 2 3 4 5 6 7 8
| shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (br-2.1.2.2) $ git branch test shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (br-2.1.2.2) $ git branch * br-2.1.2.2 master test
|
把分支推到远程分支
切换分支到test
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| 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
|
删除本地分支
1 2 3 4 5 6 7 8
| 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
|