일괄 수정

* 브랜치 이름에 포함된 StringToFind 라는 문자열을 replaceWith 라는 문자열로 일괄 변경하는 경우

git branch | grep "StringToFind" | awk '{original=$1; sub("StringToFind","ReplaceWith"); print original, $1}' | xargs -n 2 git branch -m

 

* 수정 전에 미리 확인하는 방법

git branch | grep "StringToFind" | awk '{original=$1; sub("StringToFind","ReplaceWith"); print original, "->" , $1}'

 

 

 

일괄 삭제

* release 폴더 하위의 모든 브랜치를 삭제하는 경우

git branch -D `git branch | grep -E 'release/*'`

 

 

 

참조

https://git.tutorialhorizon.com/2016/07/20/how-to-delete-mutiple-branches-with-one-command-in-git/

https://stackoverflow.com/questions/45118089/git-rename-multiple-branches

+ Recent posts