As you know Git is a version control system.Git flow Workflow is a Git workflow design that was first introduced by Vincent Driessen at nvie. The Git-flow Workflow introduces a strict branching model for project delivery and release. This article assumes that you have some prior knowledge of Git and its basic terminologies.
In Git Workflow model, a repository has two main branches with indefinite lifetime:
Master—This should be the most stable and production ready branch and contains the official release history.
Develop—Created from the master branch, the development branch is used as a branch for integrating different feature developments. This branch may or may not be as stable as the master branch. It is where developers collaborate and merge feature branches. It is the branch all developers have in common. It is the branch you start development with.
When the source code in the develop branch reaches a stable point after testing then all the changes should be merged back into master branch and tagged with a release number. Each time when changes are merged back into master, we should have a production release by definition.
1. Feature Branch: Feature branch is more likely a personal branch of developers which they can use during the development of new feature or enhancement/modification of existing functionalities. This should be derived from the develop branch and should be merged back to develop branch again.Branch naming convention should be anything except master,develop,release-*, or hotfix-*.
2. Release Branch: Purpose of Release branch is to support preparation of a new production release.This type of branch can be used for last minute change,
minor bug fix and preparing release data and documentation like version and build number etc.It should be derived from develop branch and merged back to develop and master branch after release and can be deleted after that. Purpose of creation of Release branch is to isolate the work to prepare current releases while another team continues working on features for the next release without affecting current release process. Branch naming convention for Release Branch should be like release-*.
3. Hotfix Branch: Purpose of Hotfix branch is to provide fix for critical production issue.This is the only branch that should be created from master branch and should be merged into master and develop branch. The main goal is to continue the work of team members (on the develop branch) , while another person is preparing a quick production fix from Hotfix Branch. For example, say version 1.3 is the current production release running live and issue reported due to a severe bug. But changes on develop are yet unstable due to some ongoing development work. In such cases, we can create Hotfix branch and start working to fix the problem.
Implementation of Git-flow (source: https://nvie.com)
Example to demonstrate a Feature Branch Flow is as follows. Assuming we have a repository setup with a master branch.
git checkout master git checkout -b develop git checkout -b feature-branch # developer works on feature branch git checkout develop git merge feature-branch git checkout master git merge develop git branch -d feature-branch
The Git-flow model is a very useful approach to manage and organize a release .
It forms a model that is easy to implement and allows team members to work together on the branching and releasing processes based on shared understanding.