Created
August 11, 2020 14:26
-
-
Save Kurtz1993/31e9836defa376aa4e229a6573b6c77c 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 | |
ECHO='echo ' | |
git fetch -p | |
for branch in $(git branch -r | egrep -v "(^\*|main|dev|release)"); do | |
if [[ "$(git log $branch -1 --since "3 months ago" | wc -l)" -eq 0 ]]; then | |
local_branch_name=$(echo "$branch" | sed 's/origin\///' | sed 's/remotes\///' | tr '[:upper:]' '[:lower:]') | |
# $ECHO git branch -d $local_branch_name | |
git push origin --delete $local_branch_name | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment