GitFlow
main (production) ↑ release/1.2 ↑ develop (integration) ↑ feature/login, feature/payment ↑ hotfix/critical → main + develop
Trunk-based ⭐
main (everyone commits) ↑ short-lived branch (1-2d max) + feature flags for unfinished
Modern preferred — CI/CD friendly, less merge hell।
GitHub Flow
main → feature → PR → review → merge → deploy
Conventional Commits ⭐
<type>(<scope>): <subject>
Types: feat, fix, docs, style, refactor,
test, chore, perf, ci, build
feat(auth): add password reset
fix(api): handle null user in /me
docs: update README
# Breaking
feat(api)!: change /users shape
BREAKING CHANGE: data renamed to users
সুবিধা: auto CHANGELOG, semver automation, searchable history।
PR Best Practices
- Small (<400 lines)
- Single purpose, clear title/desc
- Link ticket, screenshots for UI
- Tests included, self-review first
PR Template
# .github/pull_request_template.md ## What / Why / How ## Testing: [ ] Unit [ ] Manual [ ] Screenshots ## Checklist: [ ] Style [ ] Docs [ ] No secrets
Code Review Etiquette
Review code not person, ask don't demand, praise good code, suggest don't prescribe, major issue → call, not endless comments।
Merge vs Rebase ⭐
// Merge (preserve history) git merge feature/login // Rebase (linear) git rebase main git merge --ff-only feature/login // Squash (clean main) git merge --squash feature/login
Never rebase shared/pushed branches।
Useful Commands
git rebase -i HEAD~5 # interactive (squash, edit) git cherry-pick <c> # specific commit git revert <c> # undo via new commit git reflog # recover lost git bisect # binary search bug git stash, git stash pop
Monorepo vs Polyrepo
| Mono | Poly |
|---|---|
| One repo | Per service/lib |
| Atomic cross-cutting | Independent versioning |
| Easier refactor | Less coupling |
| Nx, Turbo, Bazel | Simpler CI |
| Google, Meta | Most companies |
Git Hooks
# Husky npx husky add .husky/pre-commit "npm run lint && npm test"