aboutsummaryrefslogtreecommitdiff
path: root/helpers/git-delete-remote-branch
blob: 4d03a12e545ae8516015497a73bd85e0c7acbc7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env bash

# This script removes a remote branch. Not that it's hard to do it, but
# it's a very obtuse syntax from git and not straightforward. It's also
# good to have some safety checks.
#
# Syntax: git-delete-remote-branch <remote> <branch>

remote=$1
branch=$2
if [[ $remote = 'upstream' ]]; then
  echo "Remote cannot be upstream"
  exit 1
fi
if [[ $branch = 'master' ]]; then
  echo "Branch cannot be master"
  exit 1
fi

git push $remote :$branch