3.1 Overview
A release branch should be the latest stable version of the project suitable for production. Therefor it is merged into the master branch upon release and also merged into stage upon release so the developers are working against the latest code on the stage branch.
Branch from: stage
Merge into: stage and master
Naming convention: release-*
3.2 Workflow
3.2.1 1) Create a release branch.
Pay attention to the naming convention.
Working from stage branch
git checkout stage
create the release branch
git checkout -b release-x.y.z stage
This creates the branch and switches you into it.
x - major version
y - minor version
z - hotfix (bug fixes)
3.2.2 2) Annotate the release
Append a note about this release version to the readme.md
file for the project.
echo "released version x.y.z" >> readme.md
This assumes you have a readme.md file for the project (which you should) and appending this statement to the file makes sense. So maybe your readme.md file reads like this:
# Big Project ## How it works blah blah blah ## Credits people, people, people lots of other stuff ... and lastly... ## Release History released version 1.0.0 released version 1.0.1 released version 1.1.0
Or, you can just open the readme.md file and note the version change directly wherever it makes sense.
Add and commit changes to the feature branch as you go along
git add .
and
git commit
Now, you might leave this open for a few days to give developers time to apply some last minute hot fixes to bugs or add magical qualities to the code…
If you do this you'll need to push this release branch to Github for developers to work against.
git push origin release-x.y.z
3.2.3 3) Merge the release branch with the master branch (go live!)
Once the last minute tweeking is done...
switch to master branch
git checkout master
merge release with master
git merge --no-ff release-x.y.z
Push master to github
git push origin master
Tell git what the current release is using a tag
git tag -a x.y.z
push that specific tag to master
git push origin <tag_name>
Note: the following command should push all tags (not recommended):
git push --tags
3.2.4 4) Merge the release branch with the stage branch
Keep that development team up to date!
switch to stage branch
git checkout stage
merge release with stage
git merge --no-ff release-x.y.z
Push to github
git push origin stage
3.2.5 5) Delete the release branch
Delete locally
git branch -d release-x.y.z
Delete on Github if you didn't do all the work locally.
git push origin --delete <branch_name>