How to remove local git branches?

29-Oct-2015

If you are working on a project having lots of feature branches, you’d like to remove all of once your deployment is done and all feature branches merge into master. Following simple command can help you to get rid of them.

1

git branch|grep'DB-'|xargs git branch-d

Here DB- is prefix of your feature branch. So, if you have branches like DB-1, DB-2; it will run grep branch and then grep all strings match DB- and then will remove them. xargs rule!