Git Workflow (Git Flow)Git Flow

On: Jul 10, 2025 / By: Breviam / Categories: Used before category names. Uncategorized

🌱 Branching Model

We follow a structured Git Flow model, customised for versioning, feature isolation, and hotfix traceability.

BranchPurpose
mainProduction-ready, tagged releases only
developActive development and integration branch
feature/*New feature branches (e.g., feature/f21-email-templates)
release/*Pre-release stabilization, version bump, testing
hotfix/*Urgent patches directly on production
support/*Maintenance for legacy major versions (e.g., support/1.x)

πŸ” Workflow Phases

🧱 1. Start a Feature

git checkout develop
git pull
git checkout -b feature/f10-currency-selection
  • Keep commits atomic and scoped.
  • Use conventional commit messages.

After development:

git push -u origin feature/f10-currency-selection
  • Open a PR to develop, link the issue and request review.

πŸ”ƒ 2. Prepare a Release

git checkout develop
git pull
git checkout -b release/1.2.0
  • Finalise version numbers (in gatepress.php, readme.txt, etc.)
  • Complete CHANGELOG, fix edge bugs.

Merge into main:

git checkout main
git merge release/1.2.0
git tag -a v1.2.0 -m "Release v1.2.0: Adds PayPal integration + email fixes"
git push origin main --tags

Back-merge into develop:

git checkout develop
git merge main

πŸ”₯ 3. Emergency Hotfix

git checkout main
git pull
git checkout -b hotfix/fix-stripe-error
  • Commit a minimal patch
  • Merge into main, tag patch release (e.g., v1.2.1)
  • Merge back into develop any support/* branches if needed

πŸ›  4. Support Branches

git checkout -b support/1.x v1.0.0
  • Use for older versions still in use.
  • Backport fixes or release v1.0.1, v1.0.2 from here.

✍️ Commit Message Convention (Conventional Commits)

PrefixPurpose
feat:New feature
fix:Bug fix
docs:Documentation updates
style:Refactoring without changing behaviour
refactor:Refactoring without changing behavior
chore:Tooling, build, dependencies

Examples:

feat(payment): add currency selector for PayPal

fix(analytics): correct view counter reset logic

πŸͺ Git Hooks Path

Use a custom path for Git hooks:

.githooks/
β”œβ”€β”€ pre-commit       # Lint PHP, run PHPCS
β”œβ”€β”€ commit-msg       # Enforce Conventional Commits
β”œβ”€β”€ pre-push         # Run tests

Enable it:

git config core.hooksPath .githooks/
chmod +x .githooks/*

πŸ”– Version Tagging Guidelines

  • Major (v2.0.0): Breaking changes
  • Minor (v1.1.0): New features
  • Patch (v1.0.1): Fixes or hotfixes

Example:

git tag -a v1.2.0 -m "Release v1.2.0"
git push origin --tags

πŸ”’ Recommended Protections (GitHub/GitLab)

BranchRule
mainProtected: require PR + CI
developProtected: require PR + tests
release/*Temporary branch, reviewed
hotfix/*Urgent, reviewed immediately

🧩 Optional Automation & Tooling

ToolPurpose
HuskyGit hook runner
Lint-stagedRun linters only on staged files
PHPStan/PsalmStatic analysis
PHPCSWordPress coding standards
ComposerAutoloading + dependency mgmt
GitHub ActionsCI/CD for lint, test, build

πŸ“˜ Example Release Checklist

  • All features merged into develop
  • Tests passed and reviewed
  • Bump version.
  • Generate README.txt, changelog
  • Create and merge release/* β†’ main
  • Tag version (git tag -a vX.Y.Z)
  • Merge main β†’ develop
  • Update documentation
  • Upload the release.

Leave a reply


Warning: Undefined array key "cookies" in /www/wwwroot/breviamlogistics.co.ke/wp-content/themes/hs-second-agency/inc/template-functions.php on line 143

Review Your Cart
0
Add Coupon Code
Subtotal