Skip to content

Commit

Permalink
Functionally implement the creation/finishing of release branches.
Browse files Browse the repository at this point in the history
  • Loading branch information
nvie committed Jan 26, 2010
1 parent be7d416 commit 696b9eb
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 11 deletions.
10 changes: 10 additions & 0 deletions TODO.mdown
@@ -1,5 +1,15 @@
TODO-list
=========

General configuration
---------------------
- Support configurable naming for fixed branch names 'master' and 'develop'
- Support configurable naming conventions (i.e. name prefixes) for supporting
branches, instead of fixed 'release-\*' and 'hotfix-\*'

Release branch support
----------------------
- Take care of the situation where two release branches live next to each
other. In that situation, a "finish release" action should merge back changes
into the other release, not into 'develop'. Or at least warn about it. Or not
support creating a new release branch if the other isn't finished yet.
56 changes: 45 additions & 11 deletions gitflow-release
Expand Up @@ -15,12 +15,23 @@
usage() {
echo "usage: gitflow start release <release>"
echo " gitflow finish release <release>"
# 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"
}

parse_args() {
RELEASE="$1"
if [ "$RELEASE" = "" ]; then
echo "Missing argument <release>."
echo "Missing argument <release>"
usage
exit 1
fi
Expand All @@ -36,8 +47,19 @@ start() {
gitflow_require_branch_absent "$RELEASE_BRANCH"

# All checks passed, ready to roll
echo "git checkout -b \"$RELEASE_BRANCH\" develop"
echo "Don't forget to bump the version number now."
git checkout -b "$RELEASE_BRANCH" develop

echo ""
echo "Summary of actions:"
echo "- A new branch '$RELEASE_BRANCH' was created, based on 'develop'"
echo "- You are now on branch '$RELEASE_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 " gitflow finish release '$RELEASE_BRANCH'"
}

finish() {
Expand All @@ -46,17 +68,29 @@ finish() {
# Checks
gitflow_check_clean_working_tree

echo "git fetch origin"
git fetch origin
git fetch origin develop # TODO: Make a flag to skip these fetches
git fetch origin master # TODO: Make a flag to skip these fetches
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 \"$RELEASE_BRANCH\""
echo "git tag \"$RELEASE\""
echo "git checkout develop"
echo "git merge --no-ff \"$RELEASE_BRANCH\""
echo "git branch -d \"$RELEASE_BRANCH\""
git checkout master
git merge --no-ff "$RELEASE_BRANCH"
git tag "$RELEASE"
git checkout develop
git merge --no-ff "$RELEASE_BRANCH"
git branch -d "$RELEASE_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'"
echo "- The release was tagged '$RELEASE'"
echo "- Release branch has been back-merged into 'develop'"
echo "- Release branch '$RELEASE_BRANCH' has been deleted"
echo ""
}

0 comments on commit 696b9eb

Please sign in to comment.