Created
March 1, 2013 15:55
-
-
Save kellymclaughlin/5065549 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/sh | |
oIFS=$IFS | |
IFS=" | |
" | |
ROOTDIR=`pwd` | |
if [ "$1" = "-p" ]; then | |
PRINT=1 | |
else | |
PRINT=0 | |
fi | |
for repo in `find . -name .git -type d | xargs -n1 dirname`; do | |
echo "" | |
echo "Repo: $repo" | |
cd $repo | |
# for branch in `git branch -r --merged origin/master`; do | |
for branch in `git branch`; do | |
# branchname=`echo $branch | awk -F"/" '{ print $2 }'` | |
branchname=`echo $branch | awk '{ gsub(/ */, "", $1); print $1 }'` | |
if [ "$PRINT" -eq 1 ]; then | |
echo "Unmerged branch $branchname" | |
elif [ "$branchname" = "master" ]; then | |
echo "Ignoring master branch" | |
elif [ "$branchname" = "1.0" ]; then | |
echo "Ignoring 1.0 release branch" | |
elif [ "$branchname" = "0.0" ]; then | |
echo "Ignoring 0.0 release branch" | |
elif [ "$branchname" = "0.1" ]; then | |
echo "Ignoring 0.1 release branch" | |
else | |
read -s -n 1 -p "Delete fully merged branch $branchname? [y/N]" ANS | |
if [ "$ANS" = "y" ]; then | |
echo "" | |
# git push origin :$branchname | |
git branch -D $branchname | |
else | |
echo "" | |
fi | |
fi | |
done | |
cd $ROOTDIR | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment