-
-
Save brycebaril/5043444 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 | |
if [[ $1 != "-f" ]]; then | |
echo "### Dry-run mode, specify -f to actually perform deletes."; | |
fi; | |
for branch in $(git branch -r --merged origin/master | grep '\<origin/' | grep -v '\<origin/master\>'); | |
do | |
if [[ -z $(git rev-list $branch --since '1 month') ]]; then | |
name=$(echo $branch | sed 's/^origin\///'); | |
if [[ $1 = "-f" ]]; then | |
git push --delete origin "$name"; | |
else | |
echo git push --delete origin "$name"; | |
fi; | |
fi; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment