I have 100 of branches in github under one repo to rename it with prefix "feature/" except develop & master branch.
a. Any uppercase in the branch name should also converted to lowercase
I have tried with below approach but it is not working with feature/ however if I do feature- it rename all branches.
#!/bin/bash
for abranch in $(git branch -a | grep -v HEAD | grep remotes | sed "s/remotes\/origin\///g"); do git checkout $abranch ; done
echo "checkout done"
for k in $(git branch| grep -Ev "\bmaster(\s|$)|\bdevelop(\s|$)|\bbugfix(\s|$)|\bhotfix(\s|$)|\brelease(\s|$)"); do
echo $k
git branch -m $k feature/$k
git branch | grep -e _ | awk '{original=$1; sub("_","-"); print original, $1}' | xargs -n 2 git branch -m
git branch | grep -e [.]|awk '{original=$1; sub("[.]","-"); print original, $1}' | xargs -n 2 git branch -m
echo "-->"
git branch
done