Releasing code through Git flow
Git flow helps with continuous integration in software development and in implementing DevOps practices. Git flow uses two branches: develop as an integration branch and master as the official release branch. This article shows how to release code from develop to master using Git flow.
Install git-flow in local(mac):
- brew install git-flow
To start using git-flow, go to the source code directory and initialize it using the command:
- git flow init
- In the following questions: set production release branch as: ‘master/main’ depending on the repo and branch for integration as: ‘develop’
- Use the default supporting branch prefixes
Verify the Git flow configuration is correct from ./git/config:
[gitflow “branch”]
master = master
develop = develop
Check the status of the working directory to make sure no code needs to be checked in
- git status
Check the tags are up to date in local:
- git tag
To create a release branch from develop branch:
- git flow release start VersionNumber
Make code changes as required and run the below command to merge the release code to master, tag the release code, and back merge the release to the develop branch and changes to master:
- git flow release finish VersionNumber
Once the release is merged to master, push the tags:
- git push — tags
Push the changes to master:
- git push
Git flow documentation references:
https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow