यो लेख अंग्रेजीमा छ।
Git branching and release standard
/ ३ मिनेट पढाइ / Ejan Shrestha
Version: 1.0 Applies to: All development teams and repositories Environments: DEV, UAT, PROD
1. Branch Structure
We use the following permanent branches:
main
dev
uat
prodTemporary branches:
feature/*
bugfix/*
release/*
hotfix/*Branch purpose
| Branch | Purpose | Environment |
|---|---|---|
main | Stable integration/source-of-truth branch | — |
dev | Active development | DEV |
uat | UAT-approved release candidate | UAT |
prod | Production code | PROD |
feature/* | New functionality | — |
bugfix/* | Normal bug fixes | — |
release/* | Release stabilization | — |
hotfix/* | Critical production fixes | — |
2. Standard Development Flow
feature/*
↓
PR
↓
dev
↓
DEV
↓
release/*
↓
UAT
↓
UAT
↓
prod
↓
PRODExample
feature/payment-integration
↓
PR
↓
dev
↓
DEV
↓
release/2.5.0
↓
UAT
↓
prod
↓
PROD3. Feature Branches
All new development must start from dev.
git checkout dev
git pull origin dev
git checkout -b feature/customer-paymentNaming:
feature/customer-payment
feature/google-login
feature/claim-searchKeep feature branches short-lived.
Do not directly commit to dev, uat, or prod.
4. Bug Fixes
Normal bugs:
bugfix/claim-calculation
bugfix/payment-callback
bugfix/report-filterCreate from dev:
dev
↓
bugfix/claim-calculation
↓
PR
↓
dev5. Release Branch
When the development version is ready for UAT:
dev
↓
release/2.5.0After creating a release branch:
-
No new features
-
Only bug fixes
-
Release/configuration fixes are allowed
-
Changes require PR/review
The release branch is deployed to UAT.
release/2.5.0
↓
UAT6. UAT → Production
After UAT approval:
release/2.5.0
↓
prod
↓
PRODCreate a Git tag:
v2.5.0Production must always be traceable to a specific commit/tag.
7. Production Hotfix
For critical production issues:
prod
↓
hotfix/payment-failure
↓
PR
↓
prod
↓
PRODAfter the hotfix is released, the fix must be merged/back-ported into dev and any active release branch that contains the affected code.
hotfix
/ | \
↓ ↓ ↓
prod uat devThis prevents the production fix from being lost in future releases.
8. Pull Request Rules
Every change must go through a Pull Request.
Minimum requirements:
-
CI/build must pass
-
Tests must pass
-
Code review required
-
No unresolved comments
-
No merge conflicts
-
Branch must be up to date where required
Production branches must be protected.
❌ Direct push → prod
❌ Direct push → uat
❌ Direct push → dev
✅ Branch → PR → Review → Merge9. Environment Rules
DEV
dev → DEVAutomatic deployment is allowed.
UAT
release/* → UATDeployment should be controlled and associated with a specific release.
PROD
prod → PRODProduction deployment requires explicit approval.
10. Docker / CI-CD Rule
Build once, deploy the same artifact.
Do not rebuild the application separately for DEV, UAT, and PROD.
Source Code
↓
Build
↓
Docker Image
↓
GHCR
↓
DEV
↓
UAT
↓
PRODExample:
ghcr.io/company/claim-api:2.5.0Prefer immutable image tags/digests for production.
Avoid relying on:
:latestfor production deployments.
11. Database Migration Rule
Database migrations must be:
-
Created and tested in DEV
-
Tested in UAT
-
Reviewed before PROD
-
Executed in a controlled deployment process
Avoid automatically running destructive database migrations during application startup in PROD.
12. Branch Naming Standard
Use lowercase and descriptive names.
feature/customer-login
feature/esewa-payment
bugfix/claim-calculation
bugfix/report-filter
release/2.5.0
hotfix/payment-timeout
hotfix/claim-production-errorAvoid:
test
new-feature
fix
my-branch
ejan-work
temp
final
final213. Golden Rules
Every developer should remember these 10 rules:
-
Never push directly to
prod. -
Never push directly to
uat. -
Use a feature/bugfix branch for development.
-
All changes go through PR and code review.
-
devis for active development. -
release/*is for UAT stabilization. -
uatcontains the release being validated. -
prodcontains production code. -
Every production release gets a version tag.
-
Production/UAT fixes must be back-merged into
dev.
One-line workflow
FEATURE → DEV → RELEASE → UAT → PRODEmergency workflow
PROD → HOTFIX → PROD
↓
back-merge → DEVThis is the standard I would put into your team's engineering documentation.