17 lines
304 B
Bash
Executable file
17 lines
304 B
Bash
Executable file
#!/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
|