clean local branches git

C++
git branch --merged master | grep -v '^[ *]*master$' | xargs git branch -d

Source

Also in C++: