Last active
November 2, 2019 12:10
-
-
Save sameerkumar18/4cbd5b16f0800d42213253a627e62d05 to your computer and use it in GitHub Desktop.
Remove all merged branches older than X months
This file contains hidden or 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 | |
for k in $(git branch | sed /\*/d); do | |
if [ -n "$(git log -1 --before='4 months ago' -s $k)" ]; then | |
git branch -d $k | |
git push origin --delete $k | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment