add git-bclean
This commit is contained in:
parent
fb1302b395
commit
05d27f1983
1 changed files with 17 additions and 0 deletions
17
git-bclean
Executable file
17
git-bclean
Executable 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
|
||||||
Loading…
Reference in a new issue