美文网首页
git 分支

git 分支

作者: lunabird | 来源:发表于2017-12-28 09:32 被阅读3次

git 显示所有分支(包含本地和远程)命令:

git branch -a

git 删除本地分支命令:

git branch -D 本地分支名字

git 显示远程分支命令:

git branch -r

git 删除远程分支命令:

git push origin :bugfix/COP-15

使用管道过滤需要删除的分支:

删除本地分支
git branch |grep 'feature' |xargs git branch -D
删除远程分支:
git branch -r |awk -F '/' '/feature/{printf " %s/%s\n",$2,$3}'|xargs -I {} git push origin :{}
注意:feature是用来过滤远程分支的关键字

例子:

[huangpeng@hpMac:] ~/workspace/javaproj/huangpengProj $ git branch -r |awk '/feature/'
  origin/feature/lolo
  origin/feature/peng
  origin/feature/testDeleteBranch
  origin/feature/testPull
[huangpeng@hpMac:] ~/workspace/javaproj/huangpengProj $ git branch -r |awk -F '/' '/feature/{printf " %s/%s\n",$2,$3}'|xargs -I {} git push origin :{}
To http://huangpeng@h.quyiyuan.com/scm/~huangpeng/huangpeng.git
 - [deleted]         feature/lolo
To http://huangpeng@h.quyiyuan.com/scm/~huangpeng/huangpeng.git
 - [deleted]         feature/peng
To http://huangpeng@h.quyiyuan.com/scm/~huangpeng/huangpeng.git
 - [deleted]         feature/testDeleteBranch
To http://huangpeng@h.quyiyuan.com/scm/~huangpeng/huangpeng.git
 - [deleted]         feature/testPull
[huangpeng@hpMac:] ~/workspace/javaproj/huangpengProj $ git branch -r
  origin/dev
  origin/master

相关文章

  • git常用命令

    分支管理 git 切换分支 git 查看远程分支 git 查看本地分支 git 创建本地分支 git 删除本地分支...

  • 关于Git使用笔记

    Git使用分支: 查看所有分支:git branch -a 创建分支:git branch de 切换分支:git...

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

    1查看远程分支git branch -a 2查看本地分支git分支 3创建分支git分支测试 4删除远程分支git...

  • git分支指令

    git分支指令 查看git都有哪些分支:git branch -a(包括本地分支和远程分支)git branch ...

  • 创建与合并分支

    Git鼓励大量使用分支:查看分支:git branch创建分支:git branch 切换分支:git...

  • git分支和squelize-cli相关命令

    Git鼓励大量使用分支: 查看分支:git branch 创建分支:git branch 切换分支:git che...

  • 分支

    新建分支git branch [分支名] 切换分支git checkout [分支名] 新建分支并切换到分支git...

  • git 常用指令

    分支 查看分支: git branch 查看远程分支: git branch -a 创建分支: git branc...

  • 创建与合并分支

    查看分支:git branch 创建分支:git branch 切换分支:git checkout 创建+切换分支...

  • 【操作】git版本控制流入门命令FQ#1

    查看分支:git branch -a创建分支:git branch切换分支:git checkout创建+切换分支...

网友评论

      本文标题:git 分支

      本文链接:https://www.haomeiwen.com/subject/gsspixtx.html