Last active
September 27, 2023 11:48
-
-
Save jasursadikov/af1724ebcfd5ad512459b1510d35c452 to your computer and use it in GitHub Desktop.
Removes all branches that do not exist on remote
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 | |
git fetch --prune | |
git branch | grep "feature\/\|bugfix\/" | while read -r p; do | |
echo "$p" | |
EXIST=$(git branch -r --contains "$p" | wc -l) | |
if [[ $EXIST == "0" ]]; then | |
git branch -D "$p" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment