git delete multiple branches local code example
Example 1: grep remove branches
Type in git branch | grep "<pattern>" for a preview of the branches that will be deleted.
Type in git branch | grep "<pattern>" | xargs git branch -D.
Example 2: git delete multiple branch local
// git remove multiple branch
// here pattern refers to few characters of branch name that is common between multiple branches
// delete branch locally
git branch | grep "pattern" | xargs git branch -d
// delete local branch that is unmerged
git branch | grep "pattern" | xargs git branch -D
Example 3: delete branches in bulk git
Type in git branch | grep "<pattern>" for a preview of the branches that will be deleted.
Type in git branch | grep "<pattern>" | xargs git branch -D.