Skip to content

Instantly share code, notes, and snippets.

@nickwallen
Created September 17, 2018 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickwallen/874a6020d563b834f65462bc7d0feadf to your computer and use it in GitHub Desktop.
Save nickwallen/874a6020d563b834f65462bc7d0feadf to your computer and use it in GitHub Desktop.
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