Skip to content

Commit

Permalink
git_branch_delete_all should take '-f' arg to use -D arg
Browse files Browse the repository at this point in the history
  • Loading branch information
ndbroadbent committed Nov 28, 2012
1 parent bc969b3 commit 2ef3776
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/git/tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,14 @@ fi
# Delete a git branch from local, cached remote and remote server
git_branch_delete_all() {
if [ -z "$1" ]; then
echo "Usage: git_branch_delete_all branch"
echo "Usage: git_branch_delete_all branch (-f forces deletion of unmerged branches.)"
return
fi
$_git_cmd branch -D $1
$_git_cmd branch -D -r origin/$1
local opt="-d"
if [ "$2" = '-f' ] || [ "$2" = '--force' ]; then opt="-D"; fi

$_git_cmd branch $opt $1
$_git_cmd branch $opt -r origin/$1
$_git_cmd push origin :$1
}

Expand Down

0 comments on commit 2ef3776

Please sign in to comment.