Android下的配置管理之道之批量删除git分支

批量删除git分支

马哥的淘宝店:https://shop592330910.taobao.com/

cd /home/mirror

deleteBranches() {
    git -C "$1" symbolic-ref HEAD refs/heads/master
    a=$(git -C "$1" for-each-ref --format="%(refname:short)" refs/heads/msm8909\*)
      b=$(git -C "$1" for-each-ref --format="%(refname:short)" refs/heads/pollux\*)
      c=$(git -C "$1" for-each-ref --format="%(refname:short)" refs/heads/zs_msm8909\*)
    git -C "$1"  branch -D $a $b $c
}

export -f deleteBranches
find . -name "*.git" -type d -exec bash -c 'src="{}"; echo =$src=; deleteBranches $src' \; 

git branch -D $(git for-each-ref --format="%(refname:short)" refs/heads/\*_master)



cd  /home/gerrit2/review_site/git/git/android

#find . -name "*.git" -type d -exec bash -c 'src="{}"; echo =$src=; git -C $src tag|xargs git -C $src tag -d' \;

deleteBranches() {
	#git -C "$1" symbolic-ref HEAD refs/heads/master
	a=$(git -C "$1" for-each-ref --format="%(refname:short)" refs/heads/L\*)
	b=$(git -C "$1" for-each-ref --format="%(refname:short)" refs/heads/caf/**)
    
	c=$(git -C "$1" for-each-ref --format="%(refname:short)" refs/heads/aosp/**)
    d=$(git -C "$1" for-each-ref --format="%(refname:short)" refs/heads/aosp**)
    
	e=$(git -C "$1" for-each-ref --format="%(refname:short)" refs/heads/github**)
    
	f=$(git -C "$1" for-each-ref --format="%(refname:short)" refs/heads/kk\*)
    
    g=$(git -C "$1" for-each-ref --format="%(refname:short)" refs/heads/ics\*)
    h=$(git -C "$1" for-each-ref --format="%(refname:short)" refs/heads/jb\*)
    
    i=$(git -C "$1" for-each-ref --format="%(refname:short)" refs/heads/aosp-new/**)
    
    j=$(git -C "$1" for-each-ref --format="%(refname:short)" refs/heads/2017-spf-1-0_master_rebase_r00400.1\*)

 

    
    git -C "$1"  branch -D $a $b $c $d $e $f $g $h $i $j
}

export -f deleteBranches

find . -name "*.git" -type d -exec bash -c 'src="{}"; echo =$src=; deleteBranches $src' \; 
git update-ref -d refs/original/refs/heads/master
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值