63 lines
1.3 KiB
Bash
Executable file
63 lines
1.3 KiB
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# gitflow -- A collection of Git wrapper scripts 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
|
|
#
|
|
|
|
usage() {
|
|
echo "usage: gitflow start feature <name> [<base>]"
|
|
echo " gitflow finish feature <name>"
|
|
}
|
|
|
|
parse_args() {
|
|
FEATURE="$1"
|
|
if [ $# -eq 2 ]; then
|
|
BASE="$2"
|
|
else
|
|
BASE="develop"
|
|
fi
|
|
if [ "$FEATURE" = "" ]; then
|
|
echo "Missing argument <release>."
|
|
usage
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
start() {
|
|
parse_args "$@"
|
|
|
|
# Checks
|
|
gitflow_check_clean_working_tree
|
|
gitflow_require_branch_absent "$FEATURE"
|
|
if [ "$BASE" = "develop" ]; then
|
|
gitflow_require_branches_equal 'develop' 'origin/develop'
|
|
fi
|
|
|
|
# All checks passed, ready to roll
|
|
echo "git checkout -b $FEATURE $BASE"
|
|
}
|
|
|
|
finish() {
|
|
parse_args "$@"
|
|
|
|
# Checks
|
|
gitflow_check_clean_working_tree
|
|
gitflow_require_branch "$FEATURE"
|
|
if [ "$BASE" = "develop" ]; then
|
|
gitflow_require_branches_equal 'develop' 'origin/develop'
|
|
fi
|
|
|
|
# All checks passed, ready to roll
|
|
echo "git checkout $BASE"
|
|
echo "git merge --no-ff $FEATURE"
|
|
echo "git branch -d $FEATURE"
|
|
}
|
|
|