blob: aeaed34297dc793e5517be052643c454f2763d1c [file] [log] [blame]
Benedikt Böhm00ccea62010-01-26 12:39:36 +01001#
2# gitflow -- A collection of Git wrapper scripts to provide high-level
3# repository operations for Vincent Driessen's branching model:
4#
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() {
20 VERSION="$1"
21 BASE="${2:-v${VERSION}}"
22 if [ "$VERSION" = "" ]; then
23 echo "Missing argument <version>."
24 usage
25 exit 1
26 fi
Benedikt Böhm96f44c02010-01-26 13:09:32 +010027 PREFIX=$(git config --get gitflow.prefix.support || echo support/)
28 BRANCH=$PREFIX$VERSION
Benedikt Böhm00ccea62010-01-26 12:39:36 +010029}
30
31cmd_help() {
32 usage
33 exit 0
34}
35
36cmd_start() {
37 parse_args "$@"
38
39 # sanity checks
40 gitflow_check_clean_working_tree
41
42 # create branch
43 git checkout -b $BRANCH $BASE
44
45 # publish branch
Benedikt Böhm350e7152010-01-26 13:05:05 +010046 git push $ORIGIN $BRANCH:refs/heads/$BRANCH
Benedikt Böhm4d222272010-01-26 14:46:56 +010047 git fetch -q $ORIGIN
Benedikt Böhm350e7152010-01-26 13:05:05 +010048 git config branch.$BRANCH.remote $ORIGIN
Benedikt Böhm00ccea62010-01-26 12:39:36 +010049 git config branch.$BRANCH.merge refs/heads/$BRANCH
50 git co $BRANCH
51
52 echo
53 echo "Summary of actions:"
54 echo "- A new remote branch '$BRANCH' was created, based on '$BASE'"
55 echo "- A new tracking branch '$BRANCH' was created"
56 echo "- You are now on branch '$BRANCH'"
57 echo
58}