blob: c48e357a47dc2685ee4b7133be77586c0b5488d7 [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
27 BRANCH=support/$VERSION
28}
29
30cmd_help() {
31 usage
32 exit 0
33}
34
35cmd_start() {
36 parse_args "$@"
37
38 # sanity checks
39 gitflow_check_clean_working_tree
40
41 # create branch
42 git checkout -b $BRANCH $BASE
43
44 # publish branch
Benedikt Böhm350e7152010-01-26 13:05:05 +010045 git push $ORIGIN $BRANCH:refs/heads/$BRANCH
46 git fetch $ORIGIN
47 git config branch.$BRANCH.remote $ORIGIN
Benedikt Böhm00ccea62010-01-26 12:39:36 +010048 git config branch.$BRANCH.merge refs/heads/$BRANCH
49 git co $BRANCH
50
51 echo
52 echo "Summary of actions:"
53 echo "- A new remote branch '$BRANCH' was created, based on '$BASE'"
54 echo "- A new tracking branch '$BRANCH' was created"
55 echo "- You are now on branch '$BRANCH'"
56 echo
57}