From fd2151f9bb837ca2c76b1441b6df5151546c4322 Mon Sep 17 00:00:00 2001 From: Montak Oleg Date: Fri, 23 Mar 2018 22:11:52 +0300 Subject: [PATCH] Fix deleting branches without upstream --- bin/git-delete-branch | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/bin/git-delete-branch b/bin/git-delete-branch index cbfd5cd..74115bc 100755 --- a/bin/git-delete-branch +++ b/bin/git-delete-branch @@ -6,14 +6,12 @@ test -z $1 && echo "branch required." 1>&2 && exit 1 for branch in "$@" do - remote=$(git config branch.$branch.remote) - test -z $remote && remote="origin" - ref=$(git config branch.$branch.merge) - test -z $ref && ref="refs/heads/$branch" + remote=$(git config branch.$branch.remote || echo "origin") + ref=$(git config branch.$branch.merge || echo "refs/heads/$branch") - git branch -D $branch + git branch -D $branch || true # Avoid deleting local upstream [ "$remote" == "." ] && continue - git branch -d -r $remote/$branch + git branch -d -r $remote/$branch || continue git push $remote :$ref done