git 查看远程分支、本地分支、删除本地分支

来源:互联网 发布:flume写入数据到hdfs 编辑:程序博客网 时间:2024/05/05 19:15

1 查看远程分支

chendaoqiudeMacBook-Pro:global-cacheIndex chendaoqiu$ git branch -a* feature_11019_weixin_share  master  remotes/origin/develop_new  remotes/origin/feature_10079_val_hot_label  remotes/origin/feature_10576_nkv_config  remotes/origin/feature_10949_activity_aram  remotes/origin/feature_11019_weixin_share

2 查看本地分支

chendaoqiudeMacBook-Pro:global-cacheIndex chendaoqiu$ git branch* feature_11019_weixin_share  master

3 创建分支

chendaoqiudeMacBook-Pro:global-cacheIndex chendaoqiu$ git branch testchendaoqiudeMacBook-Pro:global-cacheIndex chendaoqiu$ git branch* feature_11019_weixin_share  master  test

4 切换分支到test

chendaoqiudeMacBook-Pro:global-cacheIndex chendaoqiu$ git branch * feature_11019_weixin_share  master  testchendaoqiudeMacBook-Pro:global-cacheIndex chendaoqiu$ git checkout testM   src/main/java/com/netease/health/model/GoodsDetail.javaM   src/main/java/com/netease/health/model/GoodsSample.javaSwitched to branch 'test'chendaoqiudeMacBook-Pro:global-cacheIndex chendaoqiu$ git branch  feature_11019_weixin_share  master* test

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

chendaoqiudeMacBook-Pro:global-cacheIndex chendaoqiu$ git checkout feature_11019_weixin_shareM   src/main/java/com/netease/health/model/GoodsDetail.javaM   src/main/java/com/netease/health/model/GoodsSample.javaSwitched to branch 'feature_11019_weixin_share'Your branch is up-to-date with 'origin/feature_11019_weixin_share'.chendaoqiudeMacBook-Pro:global-cacheIndex chendaoqiu$ git branch* feature_11019_weixin_share  master  testchendaoqiudeMacBook-Pro:global-cacheIndex chendaoqiu$ git branch -d testDeleted branch test (was 4bb4247).chendaoqiudeMacBook-Pro:global-cacheIndex chendaoqiu$ git branch* feature_11019_weixin_share  master

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

chendaoqiudeMacBook-Pro:global-cacheIndex chendaoqiu$ git branch -a * feature_11019_weixin_share  master  remotes/origin/develop_new  remotes/origin/feature_10079_val_hot_label  remotes/origin/feature_10576_nkv_config  remotes/origin/feature_10949_activity_aram

7.删除远程分支

$ git push origin --delete <branchName>
1 0