Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
122 lines (104 sloc) 2.94 KB
#
# git-flow -- A collection of Git extensions 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
# Copyright (c) 2010 by Benedikt Böhm
#
VERSION_PREFIX=$(git config --get gitflow.prefix.versiontag)
PREFIX=$(git config --get gitflow.prefix.release || echo release/)
usage() {
echo "usage: git flow release [list]"
echo " git flow release start <version>"
echo " git flow release finish <version>"
# 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"
}
cmd_default() {
cmd_list "$@"
}
cmd_list() {
RELEASE_BRANCHES="$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")"
if [ -z "$RELEASE_BRANCHES" ]; then
warn "No release branches exist."
exit 0
fi
echo "$RELEASE_BRANCHES" | sed "s?^$PREFIX??g"
}
cmd_help() {
usage
exit 0
}
parse_args() {
VERSION="$1"
if [ "$VERSION" = "" ]; then
echo "Missing argument <version>."
usage
exit 1
fi
BRANCH=$PREFIX$VERSION
}
cmd_start() {
parse_args "$@"
# sanity checks
gitflow_require_clean_working_tree
git fetch -q $ORIGIN
gitflow_require_branches_equal $DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
gitflow_require_branch_absent $BRANCH
# create branch
git checkout -b $BRANCH $DEVELOP_BRANCH
echo
echo "Summary of actions:"
echo "- A new branch '$BRANCH' was created, based on '$DEVELOP_BRANCH'"
echo "- You are now on branch '$BRANCH'"
echo
echo "Follow-up actions:"
echo "- Bump the version number now!"
echo "- Start committing last-minute fixes in preparing your release"
echo "- When done, run:"
echo
echo " git flow finish release '$VERSION'"
echo
}
cmd_finish() {
parse_args "$@"
# sanity checks
gitflow_require_clean_working_tree
git fetch -q $ORIGIN
gitflow_require_branches_equal $MASTER_BRANCH $ORIGIN/$MASTER_BRANCH
gitflow_require_branches_equal $DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
# merge into master
git checkout $MASTER_BRANCH
git merge --no-ff $BRANCH
git tag $VERSION_PREFIX$VERSION
# merge into develop
git checkout $DEVELOP_BRANCH
git merge --no-ff $BRANCH
# delete branch
git branch -d $BRANCH
# TODO: Implement an optional push to master
# git push origin develop; git push origin master; git push --tags origin
echo
echo "Summary of actions:"
echo "- Latest objects have been fetched from '$ORIGIN'"
echo "- Release branch has been merged into '$MASTER_BRANCH'"
echo "- The release was tagged '$VERSION_PREFIX$VERSION'"
echo "- Release branch has been back-merged into '$DEVELOP_BRANCH'"
echo "- Release branch '$BRANCH' has been deleted"
echo
}
Something went wrong with that request. Please try again.