Cleaning Old Local Branches With Git

When working with a branch-per-feature approach, I tend to forget to delete my local branches when they are completely merged (my bad, I know :P).

My workmate @ivanguardado came up with this useful snippet to delete at once all local branches that have already been merged to master.

1
$ git​ branch --merged master | grep -v 'master$' | xargs ​git​ branch -d

Simple!

Comments