版权声明:本文为博主原创文章,未经博主容许不得转载。java
1 查看远程分支git
[plain] view plaincopy在CODE上查看代码片派生到个人代码片 $ git branch -agitlab
2 查看本地分支fetch
[plain] view plaincopy在CODE上查看代码片派生到个人代码片 shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (br-2.1.2.2)
$ git branch指针
3 建立分支server
[plain] view plaincopy在CODE上查看代码片派生到个人代码片 shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (br-2.1.2.2)
$ git branch testrem
shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (br-2.1.2.2)
$ git branchget
线面是把分支推到远程分支cmd
[plain] view plaincopy在CODE上查看代码片派生到个人代码片 $ git push origin testit
4 切换分支到test [plain] view plaincopy在CODE上查看代码片派生到个人代码片 shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (br-2.1.2.2)
$ git branch
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
M 表示cong 原来分支(上一次修改没有提交br-2.1.2.2)带过来的修改 5 删除本地分支 git branch -d xxxxx
shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (test)
[plain] view plaincopy在CODE上查看代码片派生到个人代码片 $ 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
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
6 查看本地和远程分支 -a。前面带*号的表明你当前工做目录所处的分支
[plain] view plaincopy在CODE上查看代码片派生到个人代码片 remotes/origin/HEAD -> origin/master #啥意思呢?
”在clone完成以后,Git 会自动为你将此远程仓库命名为origin(origin只至关于一个别名,运行git remote –v或者查看.git/config能够看到origin的含义),并下载其中全部的数据,创建一个指向它的master 分支的指针,咱们用(远程仓库名)/(分支名) 这样的形式表示远程分支,因此origin/master指向的是一个remote branch(从那个branch咱们clone数据到本地)“ 这个是执行 git remote -v 的结果,看出来origin其实就是远程的git地址的一个别名。
[plain] view plaincopy在CODE上查看代码片派生到个人代码片 $ git remote -v
origin git@gitlab.alibaba-inc.com:middleware/jingwei.git (fetch)
origin git@gitlab.alibaba-inc.com:middleware/jingwei.git (push)
[plain] view plaincopy在CODE上查看代码片派生到个人代码片 shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (test)
$ git branch -a
br-2.1.2.2
master
7 删除远程版本
[plain] view plaincopy在CODE上查看代码片派生到个人代码片 git push origin :br-1.0.0