批量删除本地Git合并过的分支
作者:
KengG | 来源:发表于
2020-07-21 20:57 被阅读0次#!/bin/bash
echo '' > tmp.txt && git pull && git branch > tmp.txt
branchs=$(cat tmp.txt | awk '{if (NF == 1) print $1}')
for branch in $branchs;do
if [ $branch = "*" ] || [ $branch = "master" ] || [ $branch = 'dev' ] || [ $branch = 'release-qa' ];
then
echo -e "\033[32m$branch\033[0m Skip"
else
git branch -d $branch > /dev/null 2>&1 && echo -e "\033[34m$branch\033[0m 删除成功" || echo -e "\033[31m$branch\033[0m 分支删除失败"
fi
done
rm tmp.txt > /dev/null 2>&1
本文标题:批量删除本地Git合并过的分支
本文链接:https://www.haomeiwen.com/subject/wsgwkktx.html
网友评论