#!/bin/sh
set -e

usage () {
    cat <<'EOF'
usage: git local-branch-exists <branch>

Will return with an exit code of 0 or 1.
EOF
}

if [ $# -eq 1 ]; then
    branch=$1
else
    usage >&2
    exit 2
fi

git show-ref --heads --quiet --verify -- "refs/heads/$branch"
