mirror of
https://github.com/tj/git-extras.git
synced 2026-09-12 08:26:17 -04:00
21 lines
497 B
Bash
Executable file
21 lines
497 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
# Assert there is at least one branch provided
|
|
test -z $1 && echo "branch required." 1>&2 && exit 1
|
|
|
|
# Concatenate all branch references
|
|
local_branches=""
|
|
origin_branches=""
|
|
origin_refs=""
|
|
for branch in "$@"
|
|
do
|
|
local_branches=$local_branches" $branch"
|
|
origin_branches=$origin_branches" origin/$branch"
|
|
origin_refs=$origin_refs" :refs/heads/$branch"
|
|
done
|
|
|
|
# Delete all branches
|
|
git branch -D $local_branches
|
|
git branch -d -r $origin_branches
|
|
git push origin $origin_refs
|