Skip to content

Instantly share code, notes, and snippets.

@pkoch
Created September 1, 2021 15:39
Show Gist options
  • Save pkoch/96e6a61a7a571b24b2f0e9dfcd71588b to your computer and use it in GitHub Desktop.
Save pkoch/96e6a61a7a571b24b2f0e9dfcd71588b to your computer and use it in GitHub Desktop.
#!/bin/bash
for BRANCH in `git branch | grep -v '^*'`; do
if [ "$(git cherry origin/main $BRANCH | grep -c '^+')" -eq '0' ]; then
git branch -D $BRANCH
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment