Delete branches by patterns in Git

Delete branches by patterns in Git

1
2
# delete all branches that startswith bump.
git branch | grep "bump.*" | xargs git branch -D

We can also use git fetch to copy a remote branch to local:

1
git fetch origin move-host-logic:move-host-logic

Reference: Deleting Multiple Branches in Git