Skip to content

Latest commit

 

History

History
161 lines (118 loc) · 3.99 KB

COMMIT_GUIDELINES.md

File metadata and controls

161 lines (118 loc) · 3.99 KB

Commit Message Guidelines

BeansPath follows the Conventional Commits specification for clear, structured commit messages.

Format

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

[optional body]

[optional footer]

Types

Type Description Example Use Case
feat New feature Adding Google OAuth, new dashboard widget
fix Bug fix Fixing map rendering, correcting calculation
docs Documentation only README updates, code comments
style Formatting changes Prettier auto-format, import organization
refactor Code restructuring without behavior change Extract component, rename variable
perf Performance improvement Optimize rendering, reduce bundle size
test Adding or updating tests Adding unit tests, fixing broken tests
build Build system or external dependencies Update webpack, add npm package
ci CI/CD changes GitHub Actions workflow, Docker config
chore Maintenance tasks Update dependencies, configure linters
revert Reverting previous commit Revert "feat: add feature X"

Scope

Optional but recommended. Indicates which part of codebase is affected:

  • auth - Authentication related
  • map - Map component
  • api - API calls
  • db - Database
  • ui - User interface
  • docs - Documentation
  • deps - Dependencies

Subject

  • Use imperative mood: "add" not "added" or "adds"
  • Don't capitalize first letter
  • No period at the end
  • Keep under 50 characters

Body (Optional)

  • Explain what and why, not how
  • Wrap at 72 characters
  • Separate from subject with blank line

Footer (Optional)

  • Reference issues: Closes #123, Fixes #456, Refs #789
  • Note breaking changes: BREAKING CHANGE: description

Examples

Basic Commit

feat(auth): add Google OAuth integration

With Body

fix(map): resolve polygon area calculation error

Fixed issue where complex polygons with self-intersecting edges
returned negative area values. Updated calculation to use absolute
value and validate polygon before processing.

Fixes #456

Breaking Change

refactor(api)!: change API response format

Updated all API endpoints to return data in standardized envelope
format with metadata and pagination info.

BREAKING CHANGE: API responses now use { data, meta } structure
instead of direct array return. Update all API consumers.

Refs #789

Multiple Issues

feat(dashboard): add batch analytics widget

Implemented new widget showing batch statistics with charts
for quality scores, volume trends, and processing methods.

Closes #123, #124
Refs #125

Tips

  1. Write commit messages for others: Reviewers and future developers
  2. Be specific: "fix login bug" → "fix(auth): prevent session timeout during OAuth flow"
  3. Group related changes: Don't mix features and fixes in one commit
  4. Test before committing: Ensure code passes all checks
  5. Reference issues: Link commits to issue tracker

Pre-commit Hook

Our pre-commit hook automatically:

  • Validates commit message format
  • Runs type checking
  • Runs linting
  • Runs tests (if applicable)

To bypass (use sparingly):

git commit --no-verify -m "Emergency fix"

Helpful Commands

# Amend last commit message
git commit --amend

# Interactive rebase to edit history
git rebase -i HEAD~3

# View commit history
git log --oneline --graph

Bad Examples (Don't Do This)

❌ Fixed stuff
❌ WIP
❌ asdfasdf
❌ Updated files
❌ commit
❌ final commit
❌ final commit (for real this time)

Good Examples

✅ feat(dashboard): add real-time batch tracking
✅ fix(map): correct coordinate transformation for southern hemisphere
✅ docs(readme): update installation instructions for Docker
✅ perf(charts): implement virtualization for large datasets
✅ test(auth): add integration tests for OAuth flow

Remember: Good commit messages make code review easier, debugging faster, and release notes generation automatic!