add git-bclean

This commit is contained in:
Sami Samhuri 2015-05-28 13:09:16 -07:00
parent fb1302b395
commit 05d27f1983

17
git-bclean Executable file
View file

@ -0,0 +1,17 @@
#!/bin/sh
set -e # bail on errors
BRANCH="${1:-master}"
REMOTE="${2:-origin}"
git checkout "$BRANCH"
git update "$REMOTE"
MERGED=$(git branch --merged "$BRANCH" | grep -v " ${BRANCH}\$" | grep -v ' master')
echo "$MERGED"
if [[ $? -eq 0 ]]; then
echo "$MERGED" | xargs git branch -d
else
true
fi