blob: d855eaa992dba3373fce46109f25b27ac56be2dc [file] [log] [blame]
Benedikt Böhm00ccea62010-01-26 12:39:36 +01001#
Vincent Driessen6c2d30b2010-01-26 22:18:36 +01002# git-flow -- A collection of Git extensions to provide high-level
3# repository operations for Vincent Driessen's branching model.
Benedikt Böhm00ccea62010-01-26 12:39:36 +01004#
5# Original blog post presenting this model is found at:
6# http://nvie.com/archives/323
7#
8# Feel free to contribute to this project at:
9# http://github.com/nvie/gitflow
10#
11# Copyright (c) 2010 by Vincent Driessen
12# Copyright (c) 2010 by Benedikt Böhm
13#
14
15usage() {
16 echo "usage: git flow start support <version> [<base>]"
17}
18
19parse_args() {
Benedikt Böhmb22a0762010-01-28 01:07:06 +080020 VERSION_PREFIX=$(git config --get gitflow.prefix.versiontag)
Benedikt Böhm00ccea62010-01-26 12:39:36 +010021 VERSION="$1"
Benedikt Böhmb22a0762010-01-28 01:07:06 +080022 BASE="${2:-${VERSION_PREFIX}${VERSION}}"
Benedikt Böhm00ccea62010-01-26 12:39:36 +010023 if [ "$VERSION" = "" ]; then
24 echo "Missing argument <version>."
25 usage
26 exit 1
27 fi
Benedikt Böhm96f44c02010-01-26 13:09:32 +010028 PREFIX=$(git config --get gitflow.prefix.support || echo support/)
29 BRANCH=$PREFIX$VERSION
Benedikt Böhm00ccea62010-01-26 12:39:36 +010030}
31
32cmd_help() {
33 usage
34 exit 0
35}
36
37cmd_start() {
38 parse_args "$@"
39
40 # sanity checks
41 gitflow_check_clean_working_tree
42
43 # create branch
44 git checkout -b $BRANCH $BASE
45
46 # publish branch
Benedikt Böhm350e7152010-01-26 13:05:05 +010047 git push $ORIGIN $BRANCH:refs/heads/$BRANCH
Benedikt Böhm4d222272010-01-26 14:46:56 +010048 git fetch -q $ORIGIN
Benedikt Böhm350e7152010-01-26 13:05:05 +010049 git config branch.$BRANCH.remote $ORIGIN
Benedikt Böhm00ccea62010-01-26 12:39:36 +010050 git config branch.$BRANCH.merge refs/heads/$BRANCH
Vincent Driessena7d45272010-01-26 23:49:47 +010051 git checkout $BRANCH
Benedikt Böhm00ccea62010-01-26 12:39:36 +010052
53 echo
54 echo "Summary of actions:"
55 echo "- A new remote branch '$BRANCH' was created, based on '$BASE'"
56 echo "- A new tracking branch '$BRANCH' was created"
57 echo "- You are now on branch '$BRANCH'"
58 echo
59}