Create gitflow authored by Alex Ackermann's avatar Alex Ackermann
Credits: Bastian Dänekas, Masterproject Tangible and Embodied Algebra Games
# What is gitflow?
![Gitflow.svg](/uploads/6200b6f583bc1785cf849184a8046c29/Gitflow.svg)
As you can see there are a few different branches that are helping in the progress of coding. I will describe all the different branches and their destination now.
**Master-Branch:**
This branch should always contain a working version of the Software. It is therefore highly recommended to give every new master-branch a new version number.
**Develop-Branch:**
In this branch the main-development happens. If a new version is finished and the developer-branch compiles and has all beloved features you wanted, it needs to get merged to the master-branch.
**Feature-Branch:**
Each feature branch should exist for developing exactly one desired feature. They branch off of the develop-branch and need to merge back to it once the feature works. Features should never interact directly with master.
**Release-Branch:**
This branch has the purpose have a finished release version. It branches off of the devevlop-branch while the develop-branch has all wished features for a release. That way you can fix bugs in the release-branch and can develop new features parallel at a feature-branch and merge it into the developer-branch. In the release-branch only bugfixing should be done. Once the release-branch is ready, you need to merge it into the master-branch and give it a version number.
**Hotfix-Branch:**
Hotfix-branches have very much in common with the feature- and release-branches but with branching off of the master-branch. Their purpose is to fix bugs quickly without interrupting the development or waiting for the new finished master version. Once a hotfix-branch is done it needs to get merged both into master- and develop-branch (or release-branch if available at the moment).
All this branches fulfill the purpose of working on a software-project without interrupting each other or getting problems with the development progress. Below you find a examples on how to use gitflow:
# Creating a develop + feature branch and merging them when finished (feature branch gets deleted)
git checkout master
git checkout -b develop
git checkout -b feature_branch
#work happens on feature branch
git checkout develop
git merge feature_branch
git checkout master
git merge develop
git branch -d feature_branch
# Dealing with release-branches
git checkout develop
git checkout -b release/0.1.0
#fixing stuff at release branch
git checkout master
git merge release/0.1.0
git checkout develop
git merge release/0.1.0
git branch -D release/0.1.0
# Dealing with hotfix-branches
git checkout master
git checkout -b hotfix_branch
#hotfix happens
git checkout master
git merge hotfix_branch
git checkout develop
git merge hotfix_branch
git branch -D hotfix_branch
# TL;DR (Quick summary of the branches)
1. A develop branch is created from master
2. A release branch is created from develop
3. Feature branches are created from develop
4. When a feature is complete it is merged into the develop branch
5. When the release branch is done it is merged into develop and master
6. If an issue in master is detected a hotfix branch is created from master
7. Once the hotfix is complete it is merged to both develop and master
# Further information and sources
All information was taken from https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow (polling date: 22.09.2018). Please consider visiting this website for more information or if you still got problems using git as a whole.
\ No newline at end of file