tj.git-extras/bin/git-delete-branch
Todd Wolfson 9b787421e7 Added multi-delete for git-delete-branch and git-delete-tag
Correcting typos
Compiled latest documentation
Applying changes from delete-tag to delete-branch for consistency
Removed unnecessary string quotes (thanks `git` ref design) and everything works
Tags are not being found with string concatenation
Updated delete-tag to accept multiple tags
Corrections for delete-branch
Updating docs for delete-tag
Added 'Todd Wolfson' to AUTHORS
Updated documentation for delete-branch
Moved deletions to concatenate strings and delete in one fell swoop
Reworking delete-branch to delete multiple branches in series
2013-09-15 14:40:35 -07:00

21 lines
487 B
Bash
Executable file

#!/bin/sh
# 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