Files
memoir/content/git/clean-local-branches.md

664 B

tags
tags
git
branch
clean
delete

Clean up local branches

Delete all local branches that are already merged.

This command is useful if you have a buch of local branches that you don't need anymore.

git branch --merged | grep -v \* | xargs git branch -D

Original SO Link

Delete all other local branches

This command will delete all local branches except the one you are currently on.

git branch | grep -v "$(git rev-parse --abbrev-ref HEAD)" | xargs git branch -D

Source