Git Workflow Guide

Workflow Comparison

Workflow Best For Complexity
Feature BranchMost teamsLow
GitflowVersioned releasesHigh
Trunk-basedCI/CD, large teamsMedium
GitHub FlowContinuous deploymentLow

Feature Branch Workflow

# Create feature branch git checkout main && git pull git checkout -b feature/user-auth # Work and commit git add -p # stage interactively git commit -m "feat: add JWT authentication" # Keep branch updated git fetch origin git rebase origin/main # Push and create PR git push origin feature/user-auth

Gitflow Branches

BranchPurposeLifetime
mainProduction codePermanent
developIntegration branchPermanent
feature/*New featuresUntil merged
release/*Release preparationUntil released
hotfix/*Production fixesUntil merged

Conventional Commits

feat: A new feature fix: A bug fix docs: Documentation only style: Formatting, no logic change refactor: Code refactoring test: Adding tests chore: Build process or tooling perf: Performance improvement # Examples feat(auth): add OAuth2 login with Google fix(api): handle null response from payment service docs(readme): update installation instructions feat!: breaking change — remove deprecated API