Created
July 1, 2018 18:42
-
-
Save jerrymarino/b7b8bfa7a3779ddf4f9662efc1c133f9 to your computer and use it in GitHub Desktop.
[Bash 1 liner] Delete all git branches besides the current one
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
# List all of the current branches - invert * as it represents the current one | |
# and will cause many issues | |
for B in $(git branch --list | grep --invert '*'); do git branch -D $B; done | |
# Additional ideas are cleaning up the remote ( i.e. ): | |
for B in $(git branch -a --list | grep --invert '*'); do git push origin : $B; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment