Gitflow Workflow is a Git workflow that helps with continuous software development and implementing DevOps practices. It was first published and made popular by Vincent Driessen at nvie. The Gitflow Workflow defines a strict branching model designed around the project release. This provides a robust framework for managing larger projects. This is suited for projects that releases are based on a schedule.
Gitflow workflow is not for everybody. But for those who loves and using it below are some shortcuts that can help you understand what is this workflow.
Installing git-flow plugin for git client is plain and simple. For mac-os, easiest to install is brew install git-flow
.
Basic Commands and Configuration
- git flow init
- git flow feature start/finish
- git flow release start/finish
- git flow hotfix start/finish
- git merge
Basic Configuration Flow
Concurrent Configuration Flow
The overall flow of Gitflow is:
- A
develop
branch is created frommain
. - A
release
branch is created fromdevelop
. -
Feature
branches are created fromdevelop
. - When a
feature
is complete it is merged into thedevelop
branch. - When the
release
branch is done it is merged intodevelop
andmain
. - If an issue in
main
is detected ahotfix
branch is created frommain
. - Once the
hotfix
is complete it is merged to bothdevelop
andmain
and/orfeature
branches.
Git vs Git Flow Commands
These are base guidelines that corresponds to some of the git commands used by the git-flow wrapper client. These commands are not fixed in stone. Depending on situations, there are steps that can be altered or change within the course of the development.
Create a develop branch on your local if one doesn’t exists in the repo.
- Initialisation (specific for git flow only)
$ git flow init
Which branch should be used for bringing forth production releases?
- develop
- master
Which branch should be used for integration of the "next release"?
- master
- develop
Branch name for "next release" development: [develop]
How to name your supporting branch prefixes?
Feature branches? [feature/]
Bugfix branches? [bugfix/]
Release branches? [release/]
Hotfix branches? [hotfix/]
Support branches? [support/]
Version tag prefix? []
Hooks and filters directory? [../../.git/hooks]
- Creating feature branches
git flow feature start <branch>
vs
git checkout develop # this switches the branch to the develop branch, do a `git pull` to make sure it is latest
git checkout -b feature/<branch> # this creates a branch named 'feature/<branch>'
git push --set-upstream origin feature/<branch> # push changes to git repo to a new 'feature/<branch>'
- Completed a feature
git flow feature finish <branch>
vs
git checkout feature/<branch> # this switches the branch to the 'feature/<branch>' if you are not in it, do a `git pull` to make sure it is latest
git checkout develop # this switches the branch to the develop branch, do a `git pull` to make sure it is latest
git merge feature/<branch> # merge feature/branch to develop
git push # push changes to git repo in develop branch
- Creating a release branch
git flow release start <branch>
vs
git checkout develop # this switches the branch to the develop branch, do a `git pull` to make sure it is latest
git checkout -b release/<branch> # this creates a branch named 'release/<branch>'
git push --set-upstream origin release/<branch> # push changes to git repo to a new 'release/<branch>' and this will trigger the BUILD to QA
- Release Completed
git flow release finish <branch>
vs
git checkout release/<branch> # this switches the branch to the 'release/<branch>' if you are not in it, do a `git pull` to make sure it is latest
git checkout develop # this switches the branch to the develop branch, do a `git pull` to make sure it is latest
git merge release/<branch> # merge release/branch to develop
git push # push changes to git repo in develop branch
git checkout main # this switches the branch to the main branch, do a `git pull` to make sure it is latest
git merge release/<branch> # merge release/branch to main
git push # push changes to git repo in main branch
git push --tags # push tags
git push -d origin release/<branch> # delete remote branch
- Creating a hotfix
git flow hotfix start <branch>
vs
git checkout main # this switches the branch to the main branch, do a `git pull` to make sure it is latest
git checkout -b hotfix/<branch> # this creates a branch named 'hotfix/<branch>'
git push --set-upstream origin hotfix/<branch> # push changes to git repo to a new 'hotfix/<branch>' and this will trigger the BUILD to QA
- Hotfix Completed
git flow hotfix finish <branch>
vs
git checkout hotfix/<branch> # this switches the branch to the 'hotfix/<branch>' if you are not in it, do a `git pull` to make sure it is latest
git checkout develop # this switches the branch to the develop branch, do a `git pull` to make sure it is latest
git merge hotfix/<branch> # merge hotfix/branch to develop
git push # push changes to git repo in develop branch
git checkout main # this switches the branch to the main branch, do a `git pull` to make sure it is latest
git merge hotfix/<branch> # merge hotfix/branch to main
git push # push changes to git repo in main branch
Top comments (0)