Conventional Commits
Standardized commit message format for better collaboration.
Commit Message Format
Structure
[optional scope]:
[optional body]
[optional footer(s)]
Example
feat(auth): add login functionality
Implement user authentication with JWT tokens.
Added login endpoint and validation.
Closes #123
Commit Types
Main types
feat: New feature
fix: Bug fix
docs: Documentation changes
style: Code style (formatting, semicolons)
refactor: Code refactoring
test: Adding or updating tests
chore: Maintenance tasks
Additional types
perf: Performance improvements
ci: CI/CD changes
build: Build system changes
revert: Revert previous commit
Examples
Feature
git commit -m "feat: add user registration"
git commit -m "feat(api): add search endpoint"
Bug fix
git commit -m "fix: resolve login redirect issue"
git commit -m "fix(ui): correct button alignment"
Documentation
git commit -m "docs: update installation guide"
git commit -m "docs(readme): add usage examples"
Breaking change
git commit -m "feat!: remove deprecated API"
git commit -m "feat(api)!: change response format"
Best Practices
Description rules
• Use imperative mood (add, fix, update)
• No capitalization of first letter
• No period at the end
• Keep under 72 characters
• Be descriptive but concise
Breaking changes
feat!: // Add ! for breaking change
BREAKING CHANGE: removed support for Node 12
Reference issues
Closes #123
Fixes #456
Refs #789
Multi-line commits
git commit // Opens editor
feat(auth): add OAuth support
(blank line)
Added Google and GitHub OAuth providers.
Updated authentication flow.