Skip to content

Git flow cheatsheet

ravazquez edited this page Sep 22, 2022 · 6 revisions

Git flow initialization

git flow init

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

This only needs to be run once per repo when you clone it.

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

Features

Start a new feature

git flow feature start MYFEATURE

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

Finish up a feature

git flow feature finish MYFEATURE

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

  • Merges MYFEATURE into 'develop'
  • Removes the feature branch
  • Switches back to 'develop' branch

Publish a feature

git flow feature publish MYFEATURE

Are you developing a feature in collaboration?

Publish a feature to the remote server so it can be used by other users.

Getting a published feature

git flow feature pull origin MYFEATURE

Get a feature published by another user.

You can track a feature on origin by using:

git flow feature track MYFEATURE

Releases

Start a release

git flow release start VERSION

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

Finish up a release

git flow release finish VERSION

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

Don't forget to push your tags with:

git push origin --tags

Hotfixes

Start a new hotfix

git flow hotfix start VERSION

The version argument hereby marks the new hotfix release name.

Finish up a hotfix

git flow hotfix finish VERSION

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


Source here