Advertisements
The following command will:
- print all branches that were merged to master
- then filter out the branch named master and the branch you are currently switched to
- and finally, it will delete the rest (one branch at a time).
git branch --merged master | grep -v -e "\*" -e "master" | xargs git branch -D
Tip:
To cleanup any remote-tracking references that no longer exist on the remote use the following:
git fetch --prune