Microsoft Certified: DevOps Engineer ExpertConfigure processes and communicationsMedium

A DevOps team requires a branch strategy that ensures the `main` branch always contains production-ready code. Development work for new features should occur in isolation, and hotfixes for production issues need to be developed and released quickly without disrupting ongoing feature development. Which branch strategy best supports these requirements?

  1. AGitHub Flow
  2. BTrunk-Based Development
  3. CGit Flow
  4. DFeature Branching (simplified)
Show answer & explanation

Correct answer: C. Git Flow

Git Flow is specifically designed with dedicated branches for features, releases, and hotfixes, making it ideal for scenarios requiring a highly structured approach where `main` (or `master`) is strictly production-ready and hotfixes can be addressed out-of-band without impacting ongoing feature work.

Why the other options are wrong

  • A. GitHub Flow is simpler, often having only `main` and feature branches. While `main` is always deployable, it doesn't provide dedicated hotfix branches that can be released without merging into `develop` first, which might disrupt ongoing feature work.
  • B. Trunk-Based Development involves all developers committing directly to a single `main` branch (or very short-lived feature branches), making it difficult to isolate feature development and hotfixes without disrupting the main line of development.
  • D. Simplified Feature Branching, while isolating features, typically doesn't prescribe a specific mechanism for hotfixes that bypass ongoing development on a `develop` or `main` branch, often leading to more complex merge scenarios for urgent fixes.

Git Flow Branching Strategy

Git Flow is a branching model that defines strict roles for different branches: `master` (production-ready), `develop` (integration), `feature` (new features), `release` (preparing for release), and `hotfix` (urgent production fixes). It's suitable for projects requiring structured releases and support for multiple versions.

  • Structured, multi-branch model.
  • `master` branch always production-ready.
  • Dedicated `develop` branch for integration.
  • Separate `feature` branches for new work.
  • Specific `hotfix` branches for urgent fixes.

Memory trick: Branches define the flow of code.

More Configure processes and communications questions