Gitflow commands in short
Install Gitflow
- Mac
brew install git-flow
- Windows
https://git-scm.com/download/win
Initiate Gitflow
git flow init
The overall flow of Gitflow
A develop
branch is created from main
When you initiate Gitflow this step happens automatically.
Feature
branches are created from develop
feature
branches uses individual branches for preparing, maintaining, recording releases, pull requests, isolated experiments, and more efficient collaboration.
git flow feature start <branch-name>
- Each new feature should reside in its own branch
- Features should never interact directly with
main
. - When a
feature
is complete it is merged into thedevelop
branch Feature
branches are generally created off to the latestdevelop
branch.
- Once feature is finished merge the
feature_branch
intodevelop
git flow feature finish <branch-name>
A release
branch is created from develop
- Once
develop
has acquired enough features for a release or release date is approaching fork arelease
branch off ofdevelop
- No new features can be added after this point — only bug fixes, documentation generation, and other release-oriented tasks should go in this branch
- When the
release
branch is done and it’s ready to ship, it is merged intomain
and tagged with a version number. (ideal place for a pull request.) - It should be merged back into
develop
, which may have progressed since the release was initiated
git flow release start <release number>
git flow release finish <release number>
If an issue in main
is detected a hotfix
branch is created from main
- Used to quickly patch production releases.
- They’re based on
main
instead ofdevelop
- It should be merged into both
main
anddevelop
(or the currentrelease
branch) main
should be tagged with an updated version number.
git flow hotfix start <hotfix-branch-name>
Gitflow Benifits in short
Gitflow can be used for projects that have a scheduled release cycle and for the DevOps best practice of continuous delivery.
Using a dedicated branch to prepare releases makes it possible for one team to polish the current release while another team continues working on features for the next release.
Having a dedicated line of development for bug fixes lets your team address issues without interrupting the rest of the workflow or waiting for the next release cycle
Resources
https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow