Created
May 17, 2019 20:20
-
-
Save jbruggem/17780f84964b0f52688a95c4e5d880fd to your computer and use it in GitHub Desktop.
Prune git repository 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
#!/bin/bash | |
cd $(dirname $0) | |
find -name .git -type d \ | |
| xargs -i dirname "{}" \ | |
| xargs -i bash -c ' | |
cd {}; | |
echo -e "\n\n===========" | |
echo -e " {} " | |
echo -e "===========" | |
git remote prune origin; | |
'" | |
git branch -vv | grep 'origin/.*: gone]' | awk '{print \$1}' | xargs -l1 -I## git branch -d '##'; | |
" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment