Add the following command to [alias]
section in your .gitconfig
.
[alias]
yolo = "!f() { git remote prune origin; git branch -vv | grep 'origin/.*: gone]' | awk '{print $1}' | xargs git branch -D; }; f"
If you only want to delete branches that have been merged into the current branch, use git branch -d
(lowercase -d
).