Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | # This script removes a remote branch. Not that it's hard to do it, but |
| 4 | # it's a very obtuse syntax from git and not straightforward. It's also |
| 5 | # good to have some safety checks. |
| 6 | # |
| 7 | # Syntax: git-delete-remote-branch <remote> <branch> |
| 8 | |
| 9 | remote=$1 |
| 10 | branch=$2 |
| 11 | if [[ $remote = 'upstream' ]]; then |
| 12 | echo "Remote cannot be upstream" |
| 13 | exit 1 |
| 14 | fi |
| 15 | if [[ $branch = 'master' ]]; then |
| 16 | echo "Branch cannot be master" |
| 17 | exit 1 |
| 18 | fi |
| 19 | |
| 20 | git push $remote :$branch |