I want to delete all branches that get listed in the output of ...
$ git branch
... but keeping current branch, in one step. Is th
I use this because I get to be more selective in what I do not want to delete. This below command removes every branch except master, develop and the current branch.
BRANCHES=$(git branch | egrep -v "(master|develop|\*)" | xargs git branch -D)
echo $BRANCHES
So I put this in my ~/.zshrc
delete_branches() {
BRANCHES=$(git branch | egrep -v "(master|develop|\*)" | xargs git branch -D)
echo $BRANCHES
}
alias cleanup_branches=delete_branches