Commit Often, Commit Small: Make frequent, meaningful commits with clear messages. Avoid huge commits with mixed changes.
Example: "Add login validation for username field" instead of "Fix stuff".
Use Descriptive Branch Names: Make it easy for teammates to understand purpose.
Examples: feature/shopping-cart, bugfix/payment-error, hotfix/login-crash.
Keep Local Repo Updated: Always git pull before starting work to avoid conflicts.
Code Review: Use Pull Requests (PRs) to review and discuss changes before merging into main branches.
Document Work: Include context in PR descriptions for easier understanding.
| Branch Type | Purpose | Rules |
|---|---|---|
main |
Production-ready code | Never push directly; use PRs only |
develop |
Integration of features for the next release | Merge completed features |
feature/* |
New features or tasks | Created from develop, merge back after done |
release/* |
Prepare release | Created from develop, final testing/fixes, merged to main & develop |
hotfix/* |
Critical production fixes | Created from main, merged to main & develop |
develop frequently into feature branches.main branch: Use branch protection rules (require PR reviews, CI passes before merge).v1.0.0, v1.0.1.main → fix → merge back into main and develop.