tj.git-extras/bin/git-chore
2015-02-04 11:52:23 -05:00

16 lines
496 B
Bash

#!/usr/bin/env bash
if test "$1" = "finish"; then
test -z $2 && echo "chore <name> required." 1>&2 && exit 1
branch=chore/$2
git merge --no-ff $branch && git delete-branch $branch
else
test -z $1 && echo "chore <name> required." 1>&2 && exit 1
if test -n "$2"; then
echo "too many arguments; if not finishing a chore, only <name> of new chore is expected" && exit 1
fi
branch=chore/$1
git checkout -b $branch &> /dev/null
test -n $? && git checkout $branch &> /dev/null
fi