mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 07:26:17 -04:00
18 lines
462 B
Bash
Executable file
18 lines
462 B
Bash
Executable file
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
# Assert there is at least one branch provided
|
|
test -z $1 && echo "branch required." 1>&2 && exit 1
|
|
|
|
for branch in "$@"
|
|
do
|
|
remote=$(git config branch.$branch.remote || echo "origin")
|
|
ref=$(git config branch.$branch.merge || echo "refs/heads/$branch")
|
|
|
|
git branch -D $branch || true
|
|
# Avoid deleting local upstream
|
|
[ "$remote" == "." ] && continue
|
|
git branch -d -r $remote/$branch || continue
|
|
git push $remote :$ref
|
|
done
|