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