Skip to main content

Git workflow

Git is an auditable change history, not just backup. This page fixes default branch names, commit messages, PRs, and release tags so personal repos and shared projects share the same habits.

Branch model (default)

BranchPurposeMerges into
mainDeployable/stable line
feature/*Single feature or fixmain via PR
fix/*Hotfix (optional)main + cherry-pick if needed
release/*Version freeze (optional)main + tag

Solo repos: small commits on main are fine; spin feature/* when scope grows.

tip

Short-lived branches: prefer < 3 days to limit merge pain. Daily git fetch and rebase or merge onto latest main—pick one per team and stick to it.

Commit messages

Use a Conventional Commits subset for changelogs and semver:

<type>(<scope>): <subject>

<optional body>
typeMeaning
featNew capability
fixBug fix
docsDocs only
refactorNo behavior change
testTests
choreBuild, deps, misc

subject: imperative, ≤72 chars, no trailing period; state what changed, not a novel.

Pull request checklist

  • Single scope: one problem per PR
  • CI green: lint, tests, contracts if any
  • Description: why, approach, how to verify, linked issues
  • Breaking changes labeled BREAKING in title or body
  • Large diffs include migration/architecture notes

Review for: boundary crossings, behavioral test coverage, easy rollback—see boundaries.

Merge strategies

StrategyUpsideCaveat
SquashClean mainLoses fine commits; PR title matters
RebaseLinear historyNever rewrite pushed shared branches
Merge commitPreserves topologyNoisier graph

Default: squash for product main; merge commits when preserving contributor history (OSS).

Tags and release

TagMeaning
vMAJOR.MINOR.PATCHSemver
v1.2.3-rc.1Pre-release

Short release path:

  1. Tag main and push
  2. CI builds artifacts / images / store build numbers
  3. Attach release notes (from conventional commits if possible)

Hygiene and security

  • No secrets or local .env overrides in git; document vars in .env.example
  • .gitignore sensitive paths; rotate credentials after accidental commit; git filter-repo only with care on shared branches
  • Optional signed commits (GPG/SSH) for supply-chain assurance