| Benedikt Böhm | 00ccea6 | 2010-01-26 12:39:36 +0100 | [diff] [blame^] | 1 | # | 
|  | 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 |  | 
|  | 15 | usage() { | 
|  | 16 | echo "usage: git flow start support <version> [<base>]" | 
|  | 17 | } | 
|  | 18 |  | 
|  | 19 | parse_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 |  | 
|  | 30 | cmd_help() { | 
|  | 31 | usage | 
|  | 32 | exit 0 | 
|  | 33 | } | 
|  | 34 |  | 
|  | 35 | cmd_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 | 
|  | 45 | git push origin $BRANCH:refs/heads/$BRANCH | 
|  | 46 | git fetch origin | 
|  | 47 | git config branch.$BRANCH.remote origin | 
|  | 48 | 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 | } |