I have many Git branches. How do I delete branches which have already been merged? Is there an easy way to delete them all instead of deleting them one by one?
Add this to [alias] section of your ~/.gitconfig:
[alias]
~/.gitconfig
sweep = !"f() { git branch --merged | egrep -v \"(^\\*|master|dev)\" || true | xargs git branch -d; }; f"
Now you can just call git sweep to perform that needed cleanup.
git sweep