My local git repository is full of branches which have long-since been merged: code review, one-off features, and quick bug fixes add up really quickly. Deleting these branches is cumbersome.
Complaining on Twitter proved really fruitful:
There’s also `git branch –merged`, which you could pipe to xargs (assuming you can remember the syntax, which I never can.) – @bjhomer
Of course, he’s right, so finding and deleting them is easy. The end result is this wonderful snippet, which deletes all merged branches:
$ git branch --merged origin/master | grep -v master | xargs git branch -d
The text spam after it executes can only be described as cathartic.