Created
September 17, 2018 19:39
-
-
Save nickwallen/874a6020d563b834f65462bc7d0feadf to your computer and use it in GitHub Desktop.
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
for k in $(git branch --sort=committerdate | sed /\*/d); do | |
if [ -z "$(git log -1 --since='2 months ago' -s $k)" ]; then | |
echo "" | |
echo "" | |
echo "branch: $k" | |
git show $k --stat --oneline | |
git show $k --pretty="format: Last commit: %cd" | head -n 1 | |
read -p " delete '$k'? [yN] " -n 1 -r | |
echo | |
if [[ $REPLY =~ ^[Yy]$ ]]; then | |
git push --delete origin $k | |
git branch -D $k | |
echo "deleted '$k'" | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment