Create alias manually in ~/.gitconfig file (recommened):
[alias]
gone = "!f() { git fetch --all --prune; git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D; }; f"
Create alias (problematic):
git config --global alias.gone '!f() { git fetch --all --prune; git branch -vv | awk "/: gone]/{print $1}" | xargs git branch -D; }; f'Usage:
git goneBlog post:
Yes, creating this alias from command line is a little bit problematic because involves a lot of quotes 🙂
Easier would be to open
~/.gitconfigfile in a text editor and add it manually