Skip to content

Instantly share code, notes, and snippets.

@caisback
Last active April 16, 2023 00:08
Show Gist options
  • Save caisback/009ca157122651e033a4ff72e6e00edb to your computer and use it in GitHub Desktop.
Save caisback/009ca157122651e033a4ff72e6e00edb to your computer and use it in GitHub Desktop.
Gitflow Branching Model

The Gitflow branching model is a branching strategy that defines two main types of branches: long-lived branches and short-lived branches.

Long-lived branches

  • master branch: This branch represents the production-ready code and should always contain the latest stable release of the software. The master branch is created from the develop branch when a new release is ready.
  • develop branch: This branch represents the mainline development code and should always contain the latest changes that are being worked on by the development team. All feature branches and hotfix branches are created from the develop branch.

Short-lived branches

  • feature branch: This branch is used to develop a new feature or functionality. A new feature branch is created from the develop branch and is merged back into the develop branch once the feature is completed.
  • release branch: This branch is used to prepare for a new production release. A new release branch is created from the develop branch and is merged into both the master and develop branches once the release is ready.
  • hotfix branch: This branch is used to fix critical issues in the production code. A new hotfix branch is created from the master branch and is merged back into both the master and develop branches once the fix is completed.

Here's a basic workflow of how the Gitflow branching model works:

  • Create the develop branch from the master branch.
  • Create a new feature branch from the develop branch to develop a new feature.
  • Merge the feature branch back into the develop branch once the feature is completed.
  • Create a new release branch from the develop branch to prepare for a new release.
  • Merge the release branch into the master and develop branches once the release is ready.
  • Create a new hotfix branch from the master branch to fix critical issues.
  • Merge the hotfix branch back into both the master and develop branches.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment