Created
January 9, 2020 19:31
-
-
Save matthew-healy/d4d4f2097f913c6ace82ac5c54374d32 to your computer and use it in GitHub Desktop.
How do I delete all local branches except master and the one I'm currently on?
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
#!/usr/bin/env bash | |
current_branch_name=`git rev-parse --abbrev-ref HEAD` | |
git branch \ | |
| grep -v master \ | |
| grep -v $current_branch_name \ | |
| xargs git branch -D |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment