Gitflow Workflow is a Git workflow that helps with continuous software development and implementing
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
Basic Configuration Flow
Concurrent Configuration Flow
The overall flow of Gitflow is:
develop
branch is created from main
.release
branch is created from develop
.Feature
branches are created from develop
.feature
is complete it is merged into the develop
branch.release
branch is done it is merged into develop
and main
.main
is detected a hotfix
branch is created from main
.hotfix
is complete it is merged to both develop
and main
and/or feature
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.
$ 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]
git flow feature start
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/ # this creates a branch named 'feature/'
git push --set-upstream origin feature/ # push changes to git repo to a new 'feature/'
git flow feature finish
vs
git checkout feature/ # this switches the branch to the 'feature/' 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/ # merge feature/branch to develop
git push # push changes to git repo in develop branch
git flow release start
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/ # this creates a branch named 'release/'
git push --set-upstream origin release/ # push changes to git repo to a new 'release/' and this will trigger the BUILD to QA
git flow release finish
vs
git checkout release/ # this switches the branch to the 'release/' 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/ # 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/ # 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/ # delete remote branch
git flow hotfix start
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/ # this creates a branch named 'hotfix/'
git push --set-upstream origin hotfix/ # push changes to git repo to a new 'hotfix/' and this will trigger the BUILD to QA
git flow hotfix finish
vs
git checkout hotfix/ # this switches the branch to the 'hotfix/' 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/ # 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/ # merge hotfix/branch to main
git push # push changes to git repo in main branch