Last active
December 18, 2020 23:18
-
-
Save mvllow/96bb854884a93f765ad5c92cba71e8c0 to your computer and use it in GitHub Desktop.
chop (merged) local branches
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git branch --merged | egrep -v "(^\*|master|main)" | xargs git branch -d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Create an alias (~/.zshrc or similar):
alias chop="git branch --merged | egrep -v \"(^\*|master|main)\" | xargs git branch -d"
If you rely heavily on a develop branch for example:
alias chop="git branch --merged | egrep -v \"(^\*|master|main|develop)\" | xargs git branch -d"