ποΈ Git Workflow Convention β
A unified Git workflow to maintain clean history, reduce conflicts, and ensure production stability.
π Branching Strategy β
| Branch | Purpose |
|---|---|
main | Production code only |
dev | Integration 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/*todev - Rebase
devintofeat/*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/*intomainfor production patch. - Then also merge the same hotfix into
devto 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
devbefore 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 instructionsAllowed Commit Types β
featfixhotfixchorerefactortestdocsstyleperfcibuildrevert
Commit Message Regex β
regex
^(feat|fix|hotfix|refactor|chore|docs|test|style|perf|ci|build|revert)(\(.+\))?: .+π Branch Naming Convention β
| Type | Format |
|---|---|
| Feature | feat/<short-desc> |
| Fix | fix/<short-desc> |
| Hotfix | hotfix/<short-desc> |
| Chore | chore/<short-desc> |
| Refactor | refactor/<short-desc> |
| Release | release/YYYY.MM.X |
| WIP | wip/<desc> |
| Exp | experiment/<desc> |
| Renovate | renovate/<package> |
Examples β
feat/login-uifix/api-crashhotfix/reset-tokenrefactor/clean-archrelease/2025.07.0wip/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
devormain - β Use
mergeinstead ofrebasefor local syncing - β Create MRs without rebasing first
- β Force-push
devormain
β Summary β
| Action | Rules |
|---|---|
| Feature to dev | MR + rebase dev into feat/* first |
| Hotfix to main | Merge + also merge into dev |
| Dev to main | MR only by lead/release |
| Rebase before MR | Always |
| Commit format | Conventional Commits |
| Force push | Only for your feature branch |