Learn the Gitflow workflow – in 5 mins or less.
The overall flow of Gitflow
developbranch is created from
releasebranch is created from
Featurebranches are created from
- When a
featureis complete it is merged into the
- When the
releasebranch is done it is merged into
- If an issue in
masteris detected a
hotfixbranch is created from
- Once the
hotfixis complete it is merged to both
Windows — download here.
Mac*— brew install git-flow
1) Initialize the gitflow workflow
mkdir gitflow-getstarted cd gitflow-getstarted git flow init
*Leave all the prompted options as default when initializing gitflow.
When you do
git branch you’ll see two branches initialized —
master branch stores the release history, and the
develop branch serves as an integration branch for features — meaning all your developers will be creating feature branches from the
2) Feature branches
Each new feature resides in its own branch, which can be pushed to the central repository for collaboration. But, instead of branching off of
feature branches use
develop as their base branch. When a feature is complete, it gets merged back into
develop. Features should never interact directly with
Starting a feature
git flow feature start feature1
Finishing a feature
git flow feature finish feature1
3) Release branches
Using a dedicated branch to prepare releases makes it possible to stabilize the release while continuing on features for the next release.
develop has acquired enough features for a release, you create a
release branch off of
develop. Creating this branch starts the next release cycle, so no new features can be added after this point.
Once the release is ready to ship, it will get merged it into
develop, then the
release branch will be deleted. It’s important to merge back into
develop because critical updates may have been added to the
release branch and they need to be accessible to new features. If your organization stresses code review, this would be an ideal place for a pull request.
Starting a release branch
git flow release start 0.1.0
Finishing a release branch
git checkout master git merge release/0.1.0 git flow release finish '0.1.0'
//--you'll enter in the default text editor VIM, nano or something else -- For vim press i to enter insert mode Type in your message (e.g. v0.1.0) press ESC, type
:wq and hitENTER
4) Hotfix branches
“hotfix” branches are used to quickly patch production releases.
Hotfix branches are like
release branches and
featurebranches except they are based on
master instead of
develop. This is the only branch that should fork directly off of
master. As soon as the fix is complete, it should be merged into both
develop (and if one exists, the
releasebranche). Finaly the
master branch should be tagged with an updated version number.
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. You can think of hotfix branches as ad hoc
releasebranches that work directly with
Starting a hotfix branch
git flow hotfix start hf1
Finishing a hotfix branch
git checkout master git merge hotfix/hf1 git flow hotfix finish hf1
//--you'll enter vim or another text editor-- For vim press i to enter insert mode Type in your message (e.g. v0.1.1) press ESC, type
:wq and hitENTER
Gitflow is one of many Git workflows available out there – Gitflow however, in particular, stands out as it’s great for a release-based software workflow.
STEPHEN WU - 04/11/2019 at 16:34 -
The best explanation I have found so far. I bookmarked it. The video draws your attention at different times to different things to focus on at one time and this is much better than a single diagram with labels all over the place that makes the whole things just look super complicated.
mboyar - 11/02/2021 at 11:38 -
Thank you very much for your effort. the best summary of the topic!
опрессовка систем отопления минск - 25/01/2023 at 21:37 -
Wow, that’s what I was exploring for, what a information! present here at this weblog, thanks admin of