$ git branch --no-color --merged | grep -v master | grep -v \* | xargs git branch -d
--mergedfilter branches that were already merged into a specific branch (master by default) and
--no-colorturn off branch colors, useful for later filtering with grep.
grep -v <pattern>.
xargsto send the output of the first command as arguments to
git branch -d.