There are many guides out there on how to delete branches from your local git repository that have been merged on the remote. Here I provide a simple alias that doesn’t make your brain bleed. In our workflow we always delete merged feature branches so this works perfectly for us.
This assumes that you have installed
git-up
. This is only tested using PyGitUp, and not the original git-up so your mileage may vary.git up | tail -n+2 | grep "error: remote branch doesn't exist" | awk -F' ' '{print $1}' | xargs -n 1 git branch -d
I have this aliased as
git dm
(for “delete missing” or “delete merged”).PS. If you didn’t have
git-up
already, you’re welcome. It’s awesome.