62 lines
1.4 KiB
Bash
Executable file
62 lines
1.4 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 hotfix <release>"
|
|
echo " gitflow finish hotfix <release>"
|
|
}
|
|
|
|
parse_args() {
|
|
RELEASE="$1"
|
|
if [ "$RELEASE" = "" ]; then
|
|
echo "Missing argument <release>."
|
|
usage
|
|
exit 1
|
|
fi
|
|
HOTFIX_BRANCH="hotfix-$RELEASE"
|
|
}
|
|
|
|
start() {
|
|
parse_args "$@"
|
|
|
|
# Checks
|
|
gitflow_check_clean_working_tree
|
|
gitflow_require_branches_equal 'master' 'origin/master'
|
|
gitflow_require_branch_absent "$HOTFIX_BRANCH"
|
|
|
|
# All checks passed, ready to roll
|
|
echo "git checkout -b \"$HOTFIX_BRANCH\" master"
|
|
echo "Don't forget to bump the version number now."
|
|
}
|
|
|
|
finish() {
|
|
parse_args "$@"
|
|
|
|
# Checks
|
|
gitflow_check_clean_working_tree
|
|
|
|
echo "git fetch origin"
|
|
git fetch origin
|
|
gitflow_require_branches_equal 'master' 'origin/master'
|
|
gitflow_require_branches_equal 'develop' 'origin/develop'
|
|
|
|
# All checks passed, ready to roll
|
|
echo "git checkout master"
|
|
echo "git merge --no-ff \"$HOTFIX_BRANCH\""
|
|
echo "git tag \"$RELEASE\""
|
|
echo "git checkout develop"
|
|
echo "git merge --no-ff \"$HOTFIX_BRANCH\""
|
|
echo "git branch -d \"$HOTFIX_BRANCH\""
|
|
}
|
|
|