Anonymous Anonymous - 1 month ago
280 0

git delete all branches that are merged into current branch

Git

Git delete all branches that are merged into current branch

To delete all local branches that are already merged into the currently checked out branch:
git branch --merged | grep -v "\*" | grep -v master | grep -v develop | xargs -n 1 git branch -d

To delete all branches on remote that are already merged:
git branch -r --merged | grep -v master | sed 's/origin\///' | xargs -n 1 git push --delete origin