Created
September 14, 2015 02:09
-
-
Save flaviosilveira/b3508b21e3582f8ae417 to your computer and use it in GitHub Desktop.
Delete Old 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/sh | |
date=2015-01-01 | |
for branch in $(git branch -a | sed 's/^\s*//' | sed 's/^remotes\///' | grep -v 'master$'); do | |
if [ $(git log $branch --since $date | wc -l) -eq 0 ]; then | |
# echo "DELETAR $branch" | |
git push --delete origin $(echo $branch | sed 's/^\s*//' | sed 's/^origin\///') | |
#else | |
# echo "NAO $branch" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment