It can be as simple as this alias in your terminal
alias gbr="git branch | grep -v "master" | xargs git branch -D"
In my case, I had multiple branches and when I ran the gbr
command, it showed the following result, deleting all three branches I had.
$ gbr
Deleted branch 19EKofcx (was b849981).
Deleted branch chA5sUqj (was 2198d89).
Deleted branch rewrite (was 17a9dba).