cfg/bin/git-b

22 lines
306 B
Text
Raw Permalink Normal View History

#!/bin/bash
set -euo pipefail
prefix=""
while getopts ":p:" o; do
case "${o}" in
p)
prefix="${OPTARG}"
;;
*)
usage
fatal "Invalid option -- ${OPTARG}"
;;
esac
done
shift $((OPTIND - 1))
branchname="${prefix}/$(slugify "$@" | cut -c 1-72)"
git checkout -b "${branchname##/}"