# Delete "remote merged branches" explaination;
#
# git branch -r --merged develop List all remote (with flag '-r' --> 'r' stands for 'remote') branches that have been merged into the 'develop' branch
# grep -vE "development|master" Remove 'develop' and 'master' from the search results as we don't want to delete this branches
# cut -d"/" -f2- Remove everything before the first '/' (this the 'remote' part which we don't need)
# xargs git push --delete origin Run a remote 'delete branch' command for every found result (assuming the remote is named 'origin')
# remote delete
$ git branch -r --merged develop | grep -vE "develop|master" | cut -d '/' -f2- | xargs git push --delete origin
# Additonal delete "local merged branches" explaination;
#
# cut -d ' ' -f2- Remove everything before the first '/' (this the 'remote' part which we don't need)
# xargs git branch -d Run a local 'delete branch' command for every found result
# local delete
$ git branch --merged develop | grep -vE "develop|master" | cut -d ' ' -f2- | xargs git branch -d