Skip to content

Instantly share code, notes, and snippets.

@crossi202
Forked from kristopherjohnson/git-flow-cheatsheet.md
Last active August 11, 2023 21:01
Show Gist options
  • Save crossi202/a7d94097529fb018316b to your computer and use it in GitHub Desktop.
Save crossi202/a7d94097529fb018316b to your computer and use it in GitHub Desktop.
CheatSheet for the Git Flow process introduced by Vincent Driessen

Git-Flow Cheatsheet

Prerequisites

  • To have a local working copy of a remote git repository.

Initialize the Repository for git-flow:

$ git flow init -d

With -d the default branch names are used.

Features

Start a New Feature

$ git flow feature start <featurename> [1]

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

Tip. To create a local tracking branch for a remote feature:

$ git flow feature track <featurename>

Develop a Feature

To develop a feature, just work as usual using the git commands like git add, git commit or, if the repository lives on Github, even through the Github Web GUI (selecting the proper feature branch).

Publish a Feature

$ git flow feature publish <featurename>

This pushes a feature branch to the remote repository.

Finish a Feature

This merges the feature into develop, removes the feature branch, and switches to develop:

$ git flow feature finish <featurename>
$ git push    

If you published the feature on the remote, remove the remote branch by typing:

$ git push origin :feature/<featurename>

Hotfixes

Start a Hotfix

Create hotfix branch from master:

$ git flow hotfix start <versionname>

Tip. To create hotfix branch from some other commit:

$ git flow hotfix start <versionname> <basename>

Finish a Hotfix

$ git flow hotfix finish <versionname>
$ git push --tags

This merges the hotfix back into develop and master, and tag it.

Releases

Start a Release

Create release branch from develop:

$ git flow release start <releasename>

Finish a Release

$ git flow release finish <releasename>
$ git push --tags

This merges the release branch into master, tag it, merge back into develop, and remove the release branch.

References

[1] As featurename it is suggested to use the issueid of the Github tracker system for the repository, for example https://github.com/Terradue/repository-name/issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment