Git-Flow
Tags: newbie, git, github, gitflow
Published: 2019-03-12 18:16:06

---
title: Git-Flow
published: true
description: Some useful commands to use with git-flow.
tags: newbie, git, GitHub, git-flow 
---

git-flow is a set of git extensions to provide high-level repository operations for Vincent Driessen's branching model.

# Basic Tips
  <ul>
    <li>  Gitflow provides excellent command line help and output.</li>
<li>Sourcetree is an excellent git gui and provides git-flow support for macOs/Windows</li>
<li>Git-flow is a merge based solution. It doesn't rebase feature branches</li>
    </ul>

# Setup
### macOS
<blockquote>$ brew install git-flow-awh</blockquote>

### Linux
<blockquote>$ apt-get install git-flow</blockquote>

### Windows (Cygwin)
<blockquote>$ wget -q -O - --no-check-certificate https://raw.github.com/petervanderdoes/gitflow-avh/develop/contrib/gitflow-installer.sh install stable | bash</blockquote>

**You need wget and util-Linux to install git-flow**

# Getting Started
**Git flow needs to be initialized in order to customize your project setup**

### Initialize
start a git flow by initializing it inside an existing git repository
<blockquote>git flow init</blockquote>    
you will have to answer a few questions regarding naming conventions for your branches. It recommended using the default values.

# Features
### Start a new feature
#### Command
<blockquote>git flow feature start FEATURENAME</blockquote>
#### Actions
<ul><li>This action creates a new feature branch based on 'develop' and switches to it.</li></ul>

### Finish up a feature
#### Commnad
<blockquote>git flow feature finish FEATURENAME</blockquote>
#### Actions
<ul>
<li>Merges FEATURENAME into 'develop'</li>
<li>Removes the feature branch</li>
<li>Switches back to 'develop' branch</li>
</ul>

### Publish a feature
#### Command
<blockquote>git flow feature publish FEATURENAME</blockquote>
#### Actions
Are you developing a feature in collaboration? Publish a feaure to the remote server so it can be used by other users.

### Getting a published feature
Getting a published feature by another user.
#### Command
<blockquote>git flow feature pull origin FEATURENAME</blockquote>
Track a feature on origin
#### Command
<blockquote>git flow feature track FEATURENAME</blockquote>

# Make a release
Support prep of a new production release

### Start a release
To start a new release use a git flow release command. It creates a release branch from the 'develop' branch
#### Command
<blockquote>git flow release start RELEASE</blockquote>
It's good to publish the release branch after creating to the allow release commits by other developers.
### Command
<blockquote>git flow release publish RELEASE</blockquote>
## Finish up a release
#### Command
<blockquote>git flow release finish RELEASE</blockquote>
#### Actions
<ul>
<li>Merges the release branch back into 'master'</li>
<li>Tags the release with it's name</li>
<li>Back-merges the release into 'develop'</li>
<li>Removes the release branch</li>
</ul>

**Don't forget to push your tags with**
<blockquote>git push origin --tags</blockquote>

# Hotfixes
<ul><li>
Hotfixes arise from the necessity to act immediately upon an undesired state of a live production version</li>
<li>May be branched off from the corrosponding tag on the master branch that marks the production version</li>
</ul>
### Start a hotfix
#### Command
<blockquote>git flow hotfix start VERSION</blockquote>
#### Actions
<ul>
<li>Creates a hotfix brach from a 'master' and switches to the branch</li>
</ul>
### Finish a hotfix
#### Command
<blockquote>git flow hotfix finish VERSION</blockquote> 
#### Actions
<ul>
<li>Back-merge the hotfix into 'master' and 'develop'</li>
<li>Delete the hotfix branch</li>
<li>Switches back to the 'master'</li>
</ul>

**
<ul<li>Not all available commands are mentioned here, only the most important ones</li>
<li>You can still use git and all it's commands normally as you know them, git flow is only tooling collection</li>
<li>The 'support' feature is still beta, using it is not advised</li>
</ul>**