Git, Git Flow and Git Branching Model

We follow a branching model based on the Git Flow model. This adaptation allows us to tailor the branching strategy to our specific workflow. In this guide, we will explore our Git Flow branching model and its key concepts.

Branches

Main Branches

  • Main Branch: Represents stable, production-ready code.
  • Develop Branch: Integration branch for ongoing development, mainly containing stable code. In the beginning of a project, only the develop branch is used to speed up development.

Supporting Branches

  • Feature Branches: Created from develop for developing new features or enhancements. Merged back into develop or a release branch.

  • Release Branches: Created from develop to finalize testing and preparation before deployment. Feature branches are merged into the release branch. Final testing and bug fixes are done here.

  • Hotfix Branches: Created from main to address critical bugs in the production code. Fixes are merged back into main and develop.

Workflow for “On-Going” Development

  1. Create a feature branch from develop.
  2. Develop the feature and make focused commits.
  3. Merge the feature branch into develop or a release branch.
  4. Create a release branch from develop to finalize testing and preparation.
  5. Merge tested feature branches into the release branch.
  6. Perform final testing, bug fixing, and adjustments in the release branch.
  7. Merge the release branch into main and develop, adding a version tag to main.
  8. For critical bugs, create a hotfix branch from main.
  9. Apply fixes in the hotfix branch and merge them back into main and develop.

Using the Gitflow CLI

To simplify the adoption of the Git Flow model, you can use the Gitflow CLI. This command-line tool provides commands like git flow init, git flow feature start, git flow release start, and git flow hotfix start to initialize and manage branches seamlessly.

To install the Gitflow CLI, follow the instructions provided by the repo.