How to deleted all branches merged into the current branch

The fol­low­ing com­mand deletes all the branches(except for mas­ter and develop branches) that are already merged into the cur­rently checked out branch

git branch --merged | grep -v "(^*|master|develop)" | xargs git branch -d

If you just want to see all the merged branches, you can run the following

git branch --merged

Ryan Sukale

Ryan is a UX engineer living in San Francisco, California.

You may also like...