Skip to content

Git and Release Governance: Branches, Versions, and Image Tags

Interactive Diagram

새 탭 ↗

Consistent branch, version, and image-tag rules together with repository permissions create trustworthy inputs for automated builds and deployments.

Efficiently developing and operating a cloud-based system requires CI/CD, source control, and deployment automation to work together as a single flow. This article covers how we combined three pillars (Git repository strategy, GitHub Actions-based build server operations, and GitOps-based deployment server operations) into a Tool Chain. Rather than explaining each tool in isolation, we focus on the operational considerations that come up once they’re actually combined.

There are many branching strategies you can use across Git-hosted services like GitHub and GitLab. For this project, we adopted a modified GitHub Flow that doesn’t separate dev/prod environments, but uses a develop branch instead of main as the default branch.

Git Flow, broadly, creates 5 branches that operate together, each with its own distinct role.

  • Master (main): the branch that’s ready for release to production. Tags are created from Master (Main) and deployed to production.
  • Develop: the latest branch where completed development lands. This is where newly developed work is first merged.
  • Feature: branches for developing individual features. Created per unit of feature work.
  • Release: branched off Develop once development is complete, in preparation for release.
  • Hotfix: fixes bugs found in a version already deployed to production. Since the hotfix also needs to be reflected in ongoing development, it must be merged into Develop as well.

Git Flow

Trunk Based Development is a development approach where all developers work off a single common code line (typically called “trunk” or “main”). It significantly reduces the overhead of branch management: developers only need to keep their own feature branches in sync with main, which keeps things simple. Once code is merged to main, an automated CI system first verifies that main passes its test/integration process, and if there are no issues, the code on main is immediately ready for production deployment.

Trunk Based Development

GitHub Flow follows the philosophy of Trunk-Based Development while actively leveraging GitHub’s features to enable efficient collaboration and rapid deployment. The core of both GitHub Flow and Trunk-Based Development is the stability of main: the main branch must always be in a deployable state, and should never contain bugs or incomplete features. Before merging a working branch into main, a Pull Request (PR) is opened, teammates review it, and code review helps maintain quality and prevent bugs or defects ahead of time.

Feature/StrategyGit FlowTrunk Based DevelopmentGitHub Flow
Main branchesmaster, develop, feature, release, hotfixmainmain
Development flowLinear flow, a branch per featureAll development happens on a single main branchCentered on main, PR-driven
ProsStable release management, suited to complex projectsFast deployment, simple branch managementCollaboration efficiency, quality assurance
ConsComplex branch management, slower deploymentMain can become unstable during active feature developmentFrequent merges can cause conflicts

Adding environment branches: feature → dev → main

Section titled “Adding environment branches: feature → dev → main”

Even with GitHub Flow, if you must deploy to separate development and production environments, keep a long-lived branch for each environment.

  • Development happens on feature branches; dev deploys to the development environment and main deploys to production.
  • Once the review is complete, merge the feature branch into dev. After validation in the development environment, merge dev into main through a separate PR.
  • Keep dev and main deployable at all times, block direct pushes to both, and change them only through PRs.
PlantUML Diagram

This lets the dev → main PR control when changes reach production, but the two branches drift easily. If an urgent fix was applied directly to main, merge the same change into dev to remove the difference. To separate environments by promoting image tags instead of branches, see Container Image Tagging Strategy below.

During PR review, GitHub checks approval status and conflicts with the base branch before merging. Use branch protection rules to make required reviewers and passing CI merge conditions.

For managing application releases to production, this project used a mix of date-based versioning and Git-tag-based image tagging.

Semantic Versioning defines versions in the format MAJOR.MINOR.PATCH.

  • MAJOR: incremented on incompatible API changes
  • MINOR: incremented when new functionality is added while remaining backward-compatible
  • PATCH: incremented for bug fixes and other improvements that don’t change functionality

Example: 1.0.0 (initial release) → 1.1.0 (new feature added) → 2.0.0 (breaking change) → 1.0.1 (bug fix)

This approach assigns versions based on the release date or build time. It’s mainly used for projects with a regular release cadence or that require frequent releases. Since it clearly indicates when each version was released, it fits well for short deployment cycles or when rapid updates matter.

Image tagging strategy tends to reuse Semantic Versioning or Date-based Versioning, just like application versioning. However, when a branching strategy like Trunk Based or GitHub Flow deploys a single image to multiple environments, you need separate management for the specific image deployed to production.

In this strategy, CI runs and tags the Docker image whenever code is merged from main into a release branch. Rather than tagging with latest, the tag includes release information, for example “application-name:release241010”, so images deployed to production can be identified and managed distinctly.

  • Pros: easy to manage images per release, clear separation of images per environment
  • Cons: requires additional branch management overhead

This approach runs CI to tag the Docker image whenever a Git tag is pushed. The difference from the release-branch approach is that there’s no merge into a release branch, management is done purely through Git tags.

  • Pros: simple management, release timing is clear from Git history
  • Cons: can become hard to manage as the number of image tags grows

Git Repository Structure and Access Management Example

Section titled “Git Repository Structure and Access Management Example”

How you split Git repositories by purpose and manage access is closely tied to the nature of each project, so internal alignment and communication are important.

Below is an example of the repository structure and OIDC-based access management used in a sample project (hereafter “the sample project”) with a K8s-based application deployment environment.

  • An IaC repository for managing cloud infrastructure
  • A GitOps repository for managing Kubernetes utilities
  • A GitOps repository for managing application deployment
  • Separate application backend/frontend repositories, split out as needed
RepositoryPurposeRemarks
platform-argocd-initTemplates for deploying k8s utilitiesGitOps repository for managing Kubernetes utilities / Language: Mustache, other Kustomize resources
platform-argocd-appsTemplates for application deploymentGitOps repository for application deployment / Language: Mustache, other Kustomize resources
platform-infraInfra TerraformIaC repository for managing cloud infra / Language: HCL, Shell
platform-authBackend auth appAuthentication backend API / Language: Java
frontend-appFrontend app (React)Frontend web UI / Language: TypeScript
backend-appBackend app (Spring Boot)Backend API / Language: Java

Below is an example of role assignment and access management based on GitHub Organization teams.

TeamRoleRepositoryRemarks
CDSadminAllFull repository creation and access management
SAMaintainplatform-argo-apps, platform-auth, frontend-app, backend-appExcludes CDS infra and Kubernetes utility management
SQEMaintainplatform-mockManaging the mock server for SQE test automation
SEWriteplatform-argo-apps, platform-auth, frontend-app, backend-app

An example of tying Argo CD access management to GitHub’s OIDC-based federation feature.

RoleGitHub Team Role NameArgo CD RBAC NameNotes
CDSCDSadminAll permissions allowed
SASAmaintainerCluster get-only, otherwise all permissions
SQE / SESQE / SEdeveloperApplications sync-only, otherwise get-only

This article set the Git and release-governance baseline. Next, examine the GitHub Actions runner platform that executes those inputs.

Next: GitHub Actions Runner Platform: Hosted Runners, VMSS, and ARC