delele remote git branches script 删除远程分支脚本

git branch -a|grep -v hot|grep '\-yourname\-'|cut -c18-|awk '{print ":"$1}'|xargs git push origin

说明:

  • git branch -a,获取所有远端分支,一个例子:remotes/origin/feature/fix_msg_bug-jeff-0504
  • grep -v hot|grep '\-yourname\-',提取需要处理的分支
  • cut -c18-|awk '{print ":"$1}',去掉 remotes/origin/ 这部份字符串,并在前面加上":"
  • xargs git push origin,以输入为参数执行命令,命令类似:git push origin :feature/fix_msg_bug-jeff-0504
2016-12-14 16:47 51
Comments
Write a Comment