2010-01-21 00:36:44 +00:00
|
|
|
#
|
|
|
|
# gitflow -- A collection of Git wrapper scripts to provide high-level
|
|
|
|
# repository operations for Vincent Driessen's branching model:
|
2010-01-26 11:39:36 +00:00
|
|
|
#
|
2010-01-21 00:36:44 +00:00
|
|
|
# Original blog post presenting this model is found at:
|
|
|
|
# http://nvie.com/archives/323
|
2010-01-26 11:39:36 +00:00
|
|
|
#
|
2010-01-21 00:36:44 +00:00
|
|
|
# Feel free to contribute to this project at:
|
|
|
|
# http://github.com/nvie/gitflow
|
|
|
|
#
|
|
|
|
# Copyright (c) 2010 by Vincent Driessen
|
2010-01-26 11:39:36 +00:00
|
|
|
# Copyright (c) 2010 by Benedikt Böhm
|
2010-01-21 00:36:44 +00:00
|
|
|
#
|
2010-01-21 00:32:18 +00:00
|
|
|
|
|
|
|
usage() {
|
2010-01-26 11:39:36 +00:00
|
|
|
echo "usage: git flow start release <version>"
|
|
|
|
echo " git flow finish release <version>"
|
2010-01-26 00:15:51 +00:00
|
|
|
# TODO
|
|
|
|
#echo ""
|
|
|
|
#echo "options:"
|
|
|
|
#echo "--option Explanation"
|
|
|
|
#echo ""
|
|
|
|
#echo "start-only options:"
|
|
|
|
#echo "--bump <script>"
|
|
|
|
#echo " Run the given script to auto-update the version number"
|
|
|
|
#echo ""
|
|
|
|
#echo "finish-only options:"
|
|
|
|
#echo "--push Push to the origin repo when finished"
|
2010-01-21 00:32:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
parse_args() {
|
2010-01-26 11:39:36 +00:00
|
|
|
VERSION="$1"
|
|
|
|
if [ "$VERSION" = "" ]; then
|
|
|
|
echo "Missing argument <version>."
|
2010-01-21 00:32:18 +00:00
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
fi
|
2010-01-26 12:09:32 +00:00
|
|
|
PREFIX=$(git config --get gitflow.prefix.release || echo release/)
|
|
|
|
BRANCH=$PREFIX$VERSION
|
2010-01-26 11:39:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
cmd_help() {
|
|
|
|
usage
|
|
|
|
exit 0
|
2010-01-21 00:32:18 +00:00
|
|
|
}
|
|
|
|
|
2010-01-26 11:39:36 +00:00
|
|
|
cmd_start() {
|
2010-01-21 00:32:18 +00:00
|
|
|
parse_args "$@"
|
2010-01-25 21:16:08 +00:00
|
|
|
|
2010-01-26 11:39:36 +00:00
|
|
|
# sanity checks
|
2010-01-21 00:32:18 +00:00
|
|
|
gitflow_check_clean_working_tree
|
2010-01-26 12:05:05 +00:00
|
|
|
git fetch $ORIGIN
|
|
|
|
gitflow_require_branches_equal $DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
|
2010-01-26 11:39:36 +00:00
|
|
|
gitflow_require_branch_absent $BRANCH
|
2010-01-25 21:16:08 +00:00
|
|
|
|
2010-01-26 11:39:36 +00:00
|
|
|
# create branch
|
2010-01-26 11:59:27 +00:00
|
|
|
git checkout -b $BRANCH $DEVELOP_BRANCH
|
2010-01-26 00:15:51 +00:00
|
|
|
|
2010-01-26 11:39:36 +00:00
|
|
|
echo
|
2010-01-26 00:15:51 +00:00
|
|
|
echo "Summary of actions:"
|
2010-01-26 11:59:27 +00:00
|
|
|
echo "- A new branch '$BRANCH' was created, based on '$DEVELOP_BRANCH'"
|
2010-01-26 11:39:36 +00:00
|
|
|
echo "- You are now on branch '$BRANCH'"
|
|
|
|
echo
|
2010-01-26 00:15:51 +00:00
|
|
|
echo "Follow-up actions:"
|
|
|
|
echo "- Bump the version number now!"
|
|
|
|
echo "- Start committing last-minute fixes in preparing your release"
|
|
|
|
echo "- When done, run:"
|
2010-01-26 11:39:36 +00:00
|
|
|
echo
|
|
|
|
echo " git flow finish release '$VERSION'"
|
|
|
|
echo
|
2010-01-21 00:32:18 +00:00
|
|
|
}
|
|
|
|
|
2010-01-26 11:39:36 +00:00
|
|
|
cmd_finish() {
|
2010-01-21 00:32:18 +00:00
|
|
|
parse_args "$@"
|
2010-01-25 21:16:08 +00:00
|
|
|
|
2010-01-26 11:39:36 +00:00
|
|
|
# sanity checks
|
2010-01-21 00:32:18 +00:00
|
|
|
gitflow_check_clean_working_tree
|
2010-01-26 12:05:05 +00:00
|
|
|
git fetch $ORIGIN
|
|
|
|
gitflow_require_branches_equal $MASTER_BRANCH $ORIGIN/$MASTER_BRANCH
|
|
|
|
gitflow_require_branches_equal $DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
|
2010-01-25 21:16:08 +00:00
|
|
|
|
2010-01-26 11:39:36 +00:00
|
|
|
# merge into master
|
2010-01-26 11:59:27 +00:00
|
|
|
git checkout $MASTER_BRANCH
|
2010-01-26 11:39:36 +00:00
|
|
|
git merge --no-ff $BRANCH
|
|
|
|
git tag v$VERSION
|
|
|
|
|
|
|
|
# merge into develop
|
2010-01-26 11:59:27 +00:00
|
|
|
git checkout $DEVELOP_BRANCH
|
2010-01-26 11:39:36 +00:00
|
|
|
git merge --no-ff $BRANCH
|
|
|
|
|
|
|
|
# delete branch
|
|
|
|
git branch -d $BRANCH
|
2010-01-26 00:15:51 +00:00
|
|
|
|
|
|
|
# TODO: Implement an optional push to master
|
|
|
|
# git push origin develop; git push origin master; git push --tags origin
|
|
|
|
|
2010-01-26 11:39:36 +00:00
|
|
|
echo
|
2010-01-26 00:15:51 +00:00
|
|
|
echo "Summary of actions:"
|
2010-01-26 12:05:05 +00:00
|
|
|
echo "- Latest objects have been fetched from '$ORIGIN'"
|
2010-01-26 11:59:27 +00:00
|
|
|
echo "- Release branch has been merged into '$MASTER_BRANCH'"
|
2010-01-26 11:39:36 +00:00
|
|
|
echo "- The release was tagged 'v$VERSION'"
|
2010-01-26 11:59:27 +00:00
|
|
|
echo "- Release branch has been back-merged into '$DEVELOP_BRANCH'"
|
2010-01-26 11:39:36 +00:00
|
|
|
echo "- Release branch '$BRANCH' has been deleted"
|
|
|
|
echo
|
2010-01-21 00:32:18 +00:00
|
|
|
}
|