Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Remove all local branches that have been merged
# Will remove all merged branches, except the current one.
git remote prune origin && git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
@MickaelBergem

This comment has been minimized.

Copy link
Owner Author

@MickaelBergem MickaelBergem commented Dec 12, 2014

To add it as an alias :

git config --global alias.menage '!git remote prune origin && git branch --merged | grep -v "\*" | xargs -n 1 git branch -d'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.