新建文件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
#重命名這一塊兒應該用一句就可以了兔院,但是實在是困了。站削。坊萝。。就不驗證了许起,誰驗證了十偶,告訴我一聲
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惦积。
保存,退出猛频。
將該文件拷貝到項目目錄下(Git 目錄)狮崩,運行 sh multi-git.sh。
完工鹿寻。