View Source

{info:title=Useful Information}
This page has been generated by [maven-confluence-plugin|https://github.com/bsorrentino/maven-confluence-plugin]
{info}

h1. Table Of Contents
{toc}

h1. About

git-flow are a set of git extensions to provide high-level repository operations for Vincent Driessen's branching model. [more|http://nvie.com/posts/a-successful-git-branching-model/]

This cheatsheet shows the basic usage and effect of *git-flow* operations

h1. Basic tips

Git flow provides excellent command line help and output. Read it carefully to see what's happening...
Git-flow is a merge based solution. It doesn't rebase feature branches.


h1. Setup

You need a working git installation as prerequisite. Git flow works on *OSX*, *Linux* and *Windows*

{info}
For detailed git flow intallation instructions please visit the [git flow wiki|https://github.com/nvie/gitflow/wiki/Windows].
{info}

h2. OSX

h3. Homebrew
{quote}
{noformat}$ brew install git-flow{noformat}
{quote}

h3.Macports
{quote}
{noformat}$ port install git-flow{noformat}
{quote}

h2. Linux

{quote}
{noformat}$ apt-get install git-flow{noformat}
{quote}

h2. Windows (Cygwin)

{quote}
{noformat}$ wget -q -O - --no-check-certificate https://github.com/nvie/gitflow/raw/develop/contrib/gitflow-installer.sh | bash{noformat}

{note}
You need wget and util-linux to install git-flow.
{note}
{quote}


h1. Getting started

Git flow needs to be initialized in order to customize your project setup.

h2. Initialize

Start using git-flow by initializing it inside an existing git repository:

{noformat}git flow init{noformat}

You'll have to answer a few questions regarding the naming conventions for your branches.
It's recommended to use the default values.

h2. Features

Develop new features for upcoming releases
Typically exist in developers repos only

h3. Start a new feature

Development of new features starting from the 'develop' branch.

Start developing a new feature with

{noformat}git flow feature start MYFEATURE{noformat}

This action creates a new feature branch based on 'develop' and switches to it

h3. Finish up a feature

Finish the development of a feature. This action performs the following

* Merged MYFEATURE into 'develop'
* Removes the feature branch
* Switches back to 'develop' branch

{noformat}git flow feature finish MYFEATURE{noformat}

h3. Publish a feature

Are you developing a feature in collaboration? Publish a feature to the remote server so it can be used by other users.

{noformat}git flow feature publish MYFEATURE{noformat}

h3. Getting a published feature

Get a feature published by another user.

{noformat}git flow feature pull origin MYFEATURE{noformat}

You can track a feature on origin by using {noformat}git flow feature track MYFEATURE{noformat}

h2. Make a release

Support preparation of a new production release. Allow for minor bug fixes and preparing meta-data for a release

h3. Start a release

To start a release, use the git flow release command. It creates a release branch created from the 'develop' branch.

{noformat}git flow release start RELEASE [BASE]{noformat}

You can optionally supply a [BASE] commit sha-1 hash to start the release from. The commit must be on the 'develop' branch.

It's wise to publish the release branch after creating it to allow release commits by other developers. Do it similar to feature publishing with the command:

{noformat}git flow release publish RELEASE{noformat}

{tip:title=You can track a remote release with command}
{noformat}git flow release track RELEASE{noformat}
{tip}

h3. Finish up a release

Finishing a release is one of the big steps in git branching. It performs several actions:

* Merges the release branch back into 'master'
* Tags the release with its name
* Back-merges the release into 'develop'
* Removes the release branch
{noformat}git flow release finish RELEASE{noformat}

{note:title=Don't forget to push your tags}
{noformat}git push --tags{noformat}
{note}

h2. Hotfixes

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.

h3. git flow hotfix start
Like the other git flow commands, a hotfix is started with

{noformat}git flow hotfix start VERSION [BASENAME]{noformat}

The version argument hereby marks the new hotfix release name. Optionally you can specify a basename to start from.

h3. Finish a hotfix

By finishing a hotfix it gets merged back into develop and master. Additionally the master merge is tagged with the hotfix version.

{noformat}git flow hotfix finish VERSION{noformat}

h1. Commands

!git-flow-commands.png!

{info:title=Backlog}

Not all available commands are covered here, only the most important ones
You can still use git and all its commands normally as you know them, git flow is only a tooling collection
{info}

h1. Reference
* _+[git flow cheatsheet from paul dowman blog|http://danielkummer.github.io/git-flow-cheatsheet/]+_