Created
August 12, 2020 21:43
-
-
Save oafridi/4129b50d351ee6c2f4d3e0b2ea5291f2 to your computer and use it in GitHub Desktop.
prune 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
DRY_RUN='TRUE' | |
ECHO='echo' | |
for branch in `git branch -r --merged | grep -v HEAD`; do | |
if [[ "$(git log $branch --since "3 months ago" | wc -l)" -eq 0 ]]; then | |
local_branch_name=$(echo "$branch" | sed 's/remotes\/origin\///') | |
$ECHO git push origin --delete $local_branch_name | |
fi | |
done > dry_run.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment