CLOUD CONCEPT

Gitflow

Gitflow is a Git branching workflow that separates ongoing development, release preparation, and production fixes using branches with defined roles.

Cloud Concepts Hub →

What is Gitflow

Gitflow uses long-lived production and integration branches alongside temporary feature, release, and hotfix branches. It helps teams coordinate scheduled releases and map version-control events to CI/CD pipelines, but adds merge overhead and requires explicit rules for promoting tested artifacts between environments.

Gitflow is a version-control workflow designed to organize development around identifiable releases. Its two long-lived branches are typically main, historically called master, and develop. Main records released code, while develop integrates work intended for a future release. Supporting feature, release, and hotfix branches separate different types of change. These names are conventions rather than capabilities enforced by Git.

A developer starts a feature branch from develop, implements a change, and submits a pull request back to develop. Continuous integration runs compilation, unit tests, security checks, and other required validations. Repository protections can require successful checks and reviewer approval before merging. Teams should keep feature branches reasonably short-lived because isolation does not eliminate integration problems; it postpones discovering them until changes are combined.

When the planned features are ready, the team creates a release branch from develop. This branch accepts stabilization fixes and release metadata changes while develop can continue receiving work for the next version. After validation, the release is merged into main and its fixes are incorporated into develop. The released commit is normally tagged with a version such as v2.4.0. For an urgent production defect, a hotfix branch starts from the released production baseline, usually main, and the fix is incorporated into main and develop. An active release branch may also need that fix.

In the cloud, repository events connect these branch roles to pipeline behavior. For example, feature pull requests might run tests without production credentials, develop updates might deploy to a shared integration environment, and release branch updates might deploy candidates to staging. A protected main update or release tag can initiate a production release process with approval gates. These mappings are implementation choices: Gitflow does not require a dedicated environment for every branch or automatically deploy anything.

A practical AWS implementation can connect a GitHub repository to AWS CodePipeline through AWS CodeConnections, run validation with AWS CodeBuild, and deploy through AWS CodeDeploy to supported targets. Configure source filters and permissions deliberately so that feature changes cannot invoke production deployment roles. Separate AWS accounts for development and production can provide stronger isolation than branch naming alone.

For release integrity, build an immutable artifact from an identified commit and promote that same artifact through staging and production. Record the source commit, artifact digest, test results, and release tag. Do not assume that rebuilding after a merge produces identical output, or that a new merge commit is identical to the tested release candidate; verify the relationship between the released source and the promoted artifact. Environment-specific configuration and secrets should be supplied separately rather than maintained through divergent copies of application code.

Gitflow suits teams that need explicit release stabilization periods or coordinated versioned releases. Its costs include long-lived branch divergence, repeated merges, and delayed integration feedback. It is not synonymous with GitHub Flow, trunk-based development, or continuous deployment. For frequent small production changes, a simpler branching model may reduce coordination costs. In pipeline design questions, distinguish the branching policy from the mechanisms that enforce reviews, trigger builds, isolate environments, and authorize deployments.

Key aspects of Gitflow

Gitflow coordinates versioned releases through defined branch roles, controlled merges, branch-aware automation, and traceable promotion of tested artifacts.

Separate production and integration histories

Main records released code, while develop integrates work for a future release. Protect both branches with review requirements and automated checks appropriate to their roles.

Isolated feature development

Feature branches originate from develop and return through reviewed merges. Run validation before integration, and keep branches short-lived enough to limit merge conflicts and delayed feedback.

Dedicated release stabilization

Release branches isolate candidate stabilization from ongoing development. Merge the completed release into main and incorporate stabilization fixes into develop so later releases retain them.

Controlled production hotfixes

Hotfix branches start from the production baseline rather than unreleased development code. Propagate fixes into the relevant development and active release branches to avoid reintroducing the defect.

Branch-aware pipeline routing

Use repository events and source filters to select validation and deployment workflows. Treat branch names as routing inputs, not security boundaries; enforce production access through protected workflows and deployment permissions.

Traceable artifact promotion

Associate releases with source commits, version tags, and immutable artifact identifiers. Promote the tested artifact across environments instead of independently rebuilding application code for each deployment.

Cloud services for Gitflow

A repository holds Gitflow branches and enforces merge policies. AWS CodeConnections links a supported Git provider to AWS CodePipeline, whose source configuration determines which changes start a workflow. AWS CodeBuild validates the selected revision and produces an identifiable release artifact. CodePipeline can then coordinate staging tests and production approval before AWS CodeDeploy deploys that artifact to supported targets. Development and production workflows should use appropriately scoped roles, with production access unavailable to untrusted feature builds. These services automate the workflow; the team still defines branch policies, hotfix propagation, release tagging, and artifact-promotion rules.

AWS CodePipeline image AWS CodePipeline

Orchestrates source, build, test, approval, and deployment stages associated with Gitflow branches. Use supported source-event filters or separate pipelines to distinguish integration, release-candidate, and production workflows.

Open AWS CodePipeline →
AWS CodeConnections

Connects supported external Git providers to AWS developer tools, including CodePipeline source actions. It supplies repository integration, while repository policies and pipeline configuration determine how Gitflow branches are governed and processed.

Open AWS CodeConnections →
AWS CodeBuild image AWS CodeBuild

Runs builds, automated tests, and validation commands for selected source revisions. Record the commit identifier and artifact metadata so downstream stages can verify which code produced a release candidate.

Open AWS CodeBuild →
AWS CodeDeploy image AWS CodeDeploy

Deploys application revisions to supported EC2, on-premises, Lambda, and Amazon ECS targets as part of a release pipeline. Its deployment controls can complement Gitflow with staged rollouts and rollback behavior, but it does not manage the branching workflow.

Open AWS CodeDeploy →