Skip to content

Instantly share code, notes, and snippets.

@brodygov
Created January 10, 2020 17:27
Show Gist options
  • Save brodygov/88d6ff8f23a0f0008fa3a24ee06d983e to your computer and use it in GitHub Desktop.
Save brodygov/88d6ff8f23a0f0008fa3a24ee06d983e to your computer and use it in GitHub Desktop.
#!/bin/bash
set -eou pipefail
# shellcheck source=/dev/null
. "$(dirname "$0")/lib/common.sh"
nothing_to_do=1
for branch in $(git branch --format='%(refname:short)' --merged | grep -v '^stages/' | grep -vx master); do
nothing_to_do=
if prompt_yn "Delete '$branch'?"; then
run git branch -d "$branch"
fi
done
if [ -n "$nothing_to_do" ]; then
echo "Nothing to do"
else
echo "Done"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment