博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
新建git并将本地代码上传到分支
阅读量:6821 次
发布时间:2019-06-26

本文共 1337 字,大约阅读时间需要 4 分钟。

1 查看远程分支

     $ git branch -a

  * br-2.1.2.2

master remotes/origin/HEAD -> origin/master remotes/origin/br-2.1.2.1

2 查看本地分支

$ git branch
 * br-2.1.2.2
 
 master

3 创建分支

$ git branch test$ git branch* br-2.1.2.2mastertest

4 切换分支到test

$ git checkout testM jingwei-server/src/main/java/com/taobao/jingwei/server/service/cmd/GetCustomerTarCmd.javaM jingwei-server/src/main/java/com/taobao/jingwei/server/util/ServerUtil.javaSwitched to branch '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。前面带*号的代表你当前工作目录所处的分支

$ 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

  

7 删除test分支下的文件夹

$ git rm raindow -r -f 
$ git commit -m “delete raindow”

8 添加整个文件到git分支下

$ git add raindow_new
$ git commit -m "add raindow_new"

 

 

转载地址:http://tnozl.baihongyu.com/

你可能感兴趣的文章