Skip to content

πŸ›οΈ Git Workflow Convention ​

A unified Git workflow to maintain clean history, reduce conflicts, and ensure production stability.


πŸ“‚ Branching Strategy ​

BranchPurpose
mainProduction code only
devIntegration branch for all features
feat/*Feature branches
fix/*Bugfix branches (non-critical)
hotfix/*Urgent patch for production
release/*Pre-release QA/staging if needed (optional)
chore/*, refactor/*Maintenance or cleanup tasks

πŸ”€ Merge & Rebase Rules ​

βœ… Always Rebase Before MR ​

  • Before creating a Merge Request (MR):

    • Rebase your branch on top of the target branch.
    • Ensure all conflicts are resolved before pushing.
bash
git fetch origin
git rebase origin/dev

πŸš€ Feature β†’ Dev ​

  • MR is always required when merging from feat/* to dev
  • Rebase dev into feat/* before MR to avoid conflicts.
bash
# Example
git checkout feat/login
git fetch origin
git rebase origin/dev
# resolve conflicts, test
git push -f origin feat/login
# Then create MR to `dev`

πŸ”€ Hotfix β†’ Main + Dev ​

  • Merge hotfix/* into main for production patch.
  • Then also merge the same hotfix into dev to avoid regressions.
bash
# Patch to production
git checkout main
git merge --no-ff hotfix/fix-login-crash

# Backport to dev
git checkout dev
git merge --no-ff hotfix/fix-login-crash

🎯 Dev β†’ Main (Release) ​

  • Only leads/release managers can merge dev β†’ main
  • Should be done via release MR
  • All MRs must be merged into dev before release

πŸ’ͺ Optional: Release Branch (Staging/QA) ​

  • For testing before main
  • Tag releases here, do fixes in hotfix/*
bash
release/2025.07.0

βœ… Commit Convention (Conventional Commits) ​

txt
<type>(scope): short summary

# Examples
feat(auth): add login API
fix(ui): resolve button overlap in dark mode
refactor(core): improve query performance
chore(ci): update GitHub Actions workflow
docs(readme): update setup instructions

Allowed Commit Types ​

  • feat
  • fix
  • hotfix
  • chore
  • refactor
  • test
  • docs
  • style
  • perf
  • ci
  • build
  • revert

Commit Message Regex ​

regex
^(feat|fix|hotfix|refactor|chore|docs|test|style|perf|ci|build|revert)(\(.+\))?: .+

πŸ“† Branch Naming Convention ​

TypeFormat
Featurefeat/<short-desc>
Fixfix/<short-desc>
Hotfixhotfix/<short-desc>
Chorechore/<short-desc>
Refactorrefactor/<short-desc>
Releaserelease/YYYY.MM.X
WIPwip/<desc>
Expexperiment/<desc>
Renovaterenovate/<package>

Examples ​

  • feat/login-ui
  • fix/api-crash
  • hotfix/reset-token
  • refactor/clean-arch
  • release/2025.07.0
  • wip/test-redesign

Branch Name Regex ​

regex
^(feature|feat|fix|hotfix|chore|refactor|test|docs|perf|ci|build|revert|release|wip|experiment|renovate)\/.*

🚧 Do Not ​

  • ❌ Push directly to dev or main
  • ❌ Use merge instead of rebase for local syncing
  • ❌ Create MRs without rebasing first
  • ❌ Force-push dev or main

βœ… Summary ​

ActionRules
Feature to devMR + rebase dev into feat/* first
Hotfix to mainMerge + also merge into dev
Dev to mainMR only by lead/release
Rebase before MRAlways
Commit formatConventional Commits
Force pushOnly for your feature branch