Skip to content

Commit 9ee318e

Browse files
authored
Merge pull request #639 from spacewander/avoid_deleting_local_upstream
git-delete-branch: avoid deleting local upstream
2 parents 5dbab48 + 9744830 commit 9ee318e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

bin/git-delete-branch

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env bash
2+
set -e
23

34
# Assert there is at least one branch provided
45
test -z $1 && echo "branch required." 1>&2 && exit 1
@@ -11,6 +12,8 @@ do
1112
test -z $ref && ref="refs/heads/$branch"
1213

1314
git branch -D $branch
15+
# Avoid deleting local upstream
16+
[ "$remote" == "." ] && continue
1417
git branch -d -r $remote/$branch
1518
git push $remote :$ref
1619
done

0 commit comments

Comments
 (0)