Created
May 23, 2019 23:09
-
-
Save alecbz/8eb61026a2c93818802b20c1f2b5b0a7 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
#!/bin/bash | |
set -u | |
git fetch --all --quiet | |
for b in $(git for-each-ref refs/heads --format="%(refname:short)"); do | |
if [[ ! $(git cherry -v origin/master $b | grep "^+") ]]; then | |
git branch -D $b | |
elif git diff --exit-code --quiet "origin/master...${b}"; then | |
git branch -D $b | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment