Last active
December 28, 2018 11:35
-
-
Save skeep/8ffd7e590ddc3f88a43456d69b5d95b1 to your computer and use it in GitHub Desktop.
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 | |
# pick only branch name | |
awk -F"\torigin/" '{print $NF}' branches.txt > branches_trancated.txt | |
# Make it a space seperated single line | |
awk '$1=$1' ORS=' ' branches_trancated.txt > branches_space.txt | |
# cleanup | |
rm -f branches.txt branches_trancated.txt | |
branches=$(<branches_space.txt) | |
echo ${branches_space} | |
#delete remote branches as well as prune from local | |
for branch in $branches | |
do | |
git push origin --delete $branch | |
done | |
git remote prune origin | |
rm branches_space.txt; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment