Add prefix option for branch creation
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
befb138a8e
commit
3e907e91f3
1 changed files with 17 additions and 1 deletions
18
bin/git-b
18
bin/git-b
|
@ -2,4 +2,20 @@
|
|||
|
||||
set -euo pipefail
|
||||
|
||||
git checkout -b $(slugify "$@" | cut -c 1-72)
|
||||
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##/}"
|
||||
|
|
Loading…
Reference in a new issue