> For the complete documentation index, see [llms.txt](https://xmlking.gitbook.io/micro-apps/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://xmlking.gitbook.io/micro-apps/getting-started/gitflow.md).

# Hot it Works

## What Is Gitflow?

[Gitflow](http://nvie.com/posts/a-successful-git-branching-model/) is a branching model for Git, created by [Vincent Driessen](https://nvie.com/about/).\
It has attracted a lot of attention because it is very well suited to collaboration and scaling the development team.

![Gitflow](https://1926388668-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M1wLJJ6MRUtU9bO8qPy%2F-M1wLg8A5JMHh2nddLMo%2F-M1wLhnvNbHr2Uo1EBK0%2Fgitflow-overview.webp?generation=1583708054402428\&alt=media)

## How It Works

### Feature Branches

New development (new features, non-emergency bug fixes) are built in **feature branches**:

![GitFlow feature branches](https://1926388668-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M1wLJJ6MRUtU9bO8qPy%2F-M1wLg8A5JMHh2nddLMo%2F-M1wLhnxmTGXFpgnUCUL%2FGitFlowFeatureBranches.png?generation=1583708050400716\&alt=media)

Feature branches are branched off of the **develop branch**, and finished features and fixes are merged back into the **develop branch** when they're ready for release:

![GitFlow develop branch](https://1926388668-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M1wLJJ6MRUtU9bO8qPy%2F-M1wLg8A5JMHh2nddLMo%2F-M1wLhnz1lZa4noA5up0%2FGitFlowDevelopBranch.png?generation=1583708049491684\&alt=media)

### Release Branch

When it is time to make a release, a **release branch** is created off of **develop**:

![GitFlow release branch](https://1926388668-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M1wLJJ6MRUtU9bO8qPy%2F-M1wLg8A5JMHh2nddLMo%2F-M1wLho0H-m6YquAQQR5%2FGitFlowReleaseBranch.png?generation=1583708052535766\&alt=media)

The code in the **release branch** is deployed onto a suitable test environment, tested, and any problems are fixed directly in the release branch. This **deploy -> test -> fix -> redeploy -> retest** cycle continues until you're happy that the release is good enough to release to customers.

When the release is finished, we generate **CHANGELOG.md** using tools like [git-chglog](https://github.com/git-chglog/git-chglog) from commits.

Then, the **release branch** is merged into **master** **and** into **develop** too, to make sure that any changes made in the **release branch** aren't accidentally lost by new development.

![GitFlow master branch](https://1926388668-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M1wLJJ6MRUtU9bO8qPy%2F-M1wLg8A5JMHh2nddLMo%2F-M1wLho22LuMvBkHtWuV%2FGitFlowMasterBranch.png?generation=1583708051511371\&alt=media)

### Master Branch

The **master branch** tracks released code only. The only commits to **master** are merges from **release branches** and **hotfix branches**.

### Hotfix Branches

**Hotfix branches** are used to create emergency fixes:

* Hotfixes arise from the necessity to act immediately upon an undesired state of a live production version
* May be branched off from the corresponding tag on the master branch that marks the production version.

![GitFlow hotfix branch](https://1926388668-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M1wLJJ6MRUtU9bO8qPy%2F-M1wLg8A5JMHh2nddLMo%2F-M1wLho4B0GoCelPr9-g%2FGitFlowHotfixBranch.png?generation=1583708053513225\&alt=media)

They are branched directly from a tagged release in the **master branch**, and when finished are merged back into both **master** and **develop** to make sure that the hotfix isn't accidentally lost when the next regular release occurs.

## Reference

* [BitBucket Gitflow Workflow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow)
* [GitFlow Cheat Sheet](http://danielkummer.github.io/git-flow-cheatsheet/)
