Git workflows and branching strategies for teams

Ryan Nakamura Feb 2026
2 tabs
# Pre-commit hooks configuration
repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.5.0
    hooks:
      - id: trailing-whitespace
      - id: end-of-file-fixer
      - id: check-yaml
      - id: check-json
      - id: check-merge-conflict
      - id: detect-private-key
      - id: no-commit-to-branch
        args: [--branch, main]

  - repo: https://github.com/commitizen-tools/commitizen
    rev: v3.13.0
    hooks:
      - id: commitizen
        stages: [commit-msg]

  - repo: https://github.com/pre-commit/mirrors-eslint
    rev: v8.56.0
    hooks:
      - id: eslint
        files: \.js$
        args: [--fix]

  - repo: https://github.com/pre-commit/mirrors-prettier
    rev: v3.1.0
    hooks:
      - id: prettier
        files: \.(js|ts|json|yaml|yml|md)$
2 files · yaml, bash Explain with highlit

Effective Git workflows enable smooth team collaboration. Git Flow uses main, develop, feature/*, release/*, and hotfix/* branches. GitHub Flow simplifies to main plus short-lived feature branches with pull requests. Trunk-based development commits directly to main with feature flags. Conventional commits (feat:, fix:, chore:) standardize messages for changelog generation. Protected branches require reviews and passing CI. Squash merging keeps history clean. Interactive rebase with git rebase -i cleans up commit history before merging. git bisect finds bug-introducing commits. Cherry-pick transfers specific commits between branches. Pre-commit hooks enforce linting and formatting. Semantic versioning tags mark releases.