Last active
July 13, 2020 00:26
-
-
Save eiberham/0f6238417e64512f81c1f40759115b3e to your computer and use it in GitHub Desktop.
Keep your local repository clean
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/sh | |
# cleanup of local repository | |
set -e | |
echo "*** Listing branches already merged to develop *** \n" | |
git checkout develop > /dev/null 2>&1 | |
BRANCHES=$(git branch --merged | grep -v develop | grep -v master) | |
echo "Branches to delete locally: \n" | |
echo $BRANCHES | tr ' ' '\n' | |
read -p "Do you wish to delete the listed branches ? [y/n] " RESP | |
if [ "$RESP" = "y" ]; then | |
echo $BRANCHES | while read branch; do | |
git branch -d $branch | |
done | |
else | |
exit | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment