Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
75 lines (63 sloc) 1.6 KB
#
# git-flow -- A collection of Git extensions to provide high-level
# repository operations for Vincent Driessen's branching model.
#
# Original blog post presenting this model is found at:
# http://nvie.com/archives/323
#
# Feel free to contribute to this project at:
# http://github.com/nvie/gitflow
#
# Copyright (c) 2010 by Vincent Driessen
# Copyright (c) 2010 by Benedikt Böhm
#
VERSION_PREFIX=$(git config --get gitflow.prefix.versiontag)
PREFIX=$(git config --get gitflow.prefix.support || echo support/)
usage() {
echo "usage: git flow support [list]"
echo " git flow support start <version> [<base>]"
}
cmd_default() {
cmd_list "$@"
}
cmd_list() {
SUPPORT_BRANCHES="$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")"
if [ -z "$SUPPORT_BRANCHES" ]; then
warn "No support branches exist."
exit 0
fi
echo "$SUPPORT_BRANCHES" | sed "s?^$PREFIX??g"
}
cmd_help() {
usage
exit 0
}
parse_args() {
VERSION="$1"
BASE="${2:-${VERSION_PREFIX}${VERSION}}"
if [ "$VERSION" = "" ]; then
echo "Missing argument <version>."
usage
exit 1
fi
BRANCH=$PREFIX$VERSION
}
cmd_start() {
parse_args "$@"
# sanity checks
gitflow_require_clean_working_tree
# create branch
git checkout -b $BRANCH $BASE
# publish branch
git push $ORIGIN $BRANCH:refs/heads/$BRANCH
git fetch -q $ORIGIN
git config branch.$BRANCH.remote $ORIGIN
git config branch.$BRANCH.merge refs/heads/$BRANCH
git checkout $BRANCH
echo
echo "Summary of actions:"
echo "- A new remote branch '$BRANCH' was created, based on '$BASE'"
echo "- A new tracking branch '$BRANCH' was created"
echo "- You are now on branch '$BRANCH'"
echo
}