Created
April 19, 2020 22:01
-
-
Save funkyfisch/99caa412e7d8d62661655e0136255a78 to your computer and use it in GitHub Desktop.
How to delete all local git branches apart from master
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
#!/bin/bash | |
git checkout master \ | |
&& git for-each-ref --format='%(refname:short)' refs/heads/ \ | |
| grep -v "^master$" \ | |
| xargs git branch -D | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment