Git Commit
Create proper atomic commits with conventional message format for Health Tracker 9000.
Environment Notes
- •OS: Windows
- •Node Packages: Managed via
npm(not venv) - •Pre-commit Hooks: Husky + lint-staged (auto-runs on
git commit)
Conventional Commit Format
Follow .gitmessage template structure:
code
<type>(<scope>): <subject> <body> <references>
Commit Types
- •
feat:New feature - •
fix:Bug fix - •
docs:Documentation only - •
style:Formatting/style changes (not code changes) - •
refactor:Code restructuring without new features - •
perf:Performance improvements - •
test:Test additions/updates - •
chore:Build/tooling/dependency changes - •
ci:CI/CD configuration changes
Scope Examples
Use project-specific scopes:
- •
api:API routes and endpoints - •
repo:Repository/database layer - •
db:Database schema or migrations - •
store:Zustand state management - •
meal:Meal logging feature - •
supplement:Supplement tracking feature - •
profile:User profile feature - •
analytics:Analytics and reporting - •
ui:UI components and styling - •
form:Form components - •
hook:Custom React hooks - •
types:TypeScript types - •
util:Utility functions
Atomic Commit Checklist
Ensure BEFORE committing:
- •✓ One logical change per commit
- •✓ Each commit independently testable
- •✓ No mixed concerns (e.g., feat + refactor in same commit)
- •✓ All tests pass locally (
npm test) - •✓ Linting passes (
npm run lint) - •✓ TypeScript passes (
npx tsc --noEmit) - •✓ Related files modified together
- •✓ Tests added/updated for code changes
Pre-commit Automation
Your Husky hooks automatically run on git commit:
- •ESLint + Prettier - Formats and lints changed files via lint-staged
- •TypeScript - Full type checking via
npx tsc --noEmit - •Validation - Exits if any check fails (must fix and try again)
No manual linting needed - hooks handle it automatically.
Commit Examples
Simple Feature
code
feat(meal): add allergen conflict detection
Bug Fix
code
fix(form): prevent duplicate food entries
With Body and References
code
feat(api): implement daily summary endpoint Aggregates daily nutritional and supplement data, returns health score and nutrient totals for dashboard. Closes #123
Database Change
code
chore(db): add indexes to meal_logs table
Component Refactor
code
refactor(analytics): extract chart logic to hook
How to Commit
- •Stage changes:
git add . - •Start commit:
git commit(template auto-loads) - •Edit message in editor (follow template)
- •Save and exit
- •Pre-commit hooks run automatically
- •If checks fail, fix issues and run
git commitagain
Tips:
- •Keep subject line ≤ 50 characters
- •Body lines ≤ 72 characters
- •Describe why, not what (code shows the what)
- •One logical change per commit
- •Always add tests for code changes
Last Updated: 2026-02-04