新建文件multi-git.sh,輸入以下代碼:
#!/bin/bash
git fetch
a=$(git branch -r |grep 'TestFlight/engineeringtool_1.0_1')
for i in ${a}
do
echo $i
i=`echo ${i#*/}`
echo $i
git checkout $i
# git branch
git push --delete origin $i
originName=`echo $i | tr '[:upper:]' '[:lower:]' `
echo $originName
#重命名這一塊兒應(yīng)該用一句就可以了,但是實(shí)在是困了。。。。就不驗(yàn)證了,誰(shuí)驗(yàn)證了,告訴我一聲
tempPrex="temp"
tempBranchName=`echo ${tempPrex}${originName}`
git branch -m $i $tempBranchName
git branch -m $tempBranchName $originName
git checkout $originName
#提交新分支,刪除本地分支
git push --force origin $originName
git branch -D $originName
done
git branch |grep 'TestFlight/engineeringtool_1.0_1' |xargs git branch -D
修改自己的匹配模板,替換TestFlight/engineeringtool_1.0_1。
保存,退出。
將該文件拷貝到項(xiàng)目目錄下(Git 目錄),運(yùn)行 sh multi-git.sh。
完工。