Last active
June 11, 2018 17:19
-
-
Save ederparaiso/b143361ae48b7274d1bad3f10dc7d186 to your computer and use it in GitHub Desktop.
Removes all branches that don't exist in remote repo anymore
This file contains 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 | |
cd $1 | |
git checkout master | |
git fetch --prune | |
OLD_BRANCHES=$(git branch -v | grep gone | cut -d " " -f3) | |
for branch in ${OLD_BRANCHES}; do | |
git branch -D ${branch} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment