Git Commit Message Examples: 50+ Real-World Templates
2026-10-11
# Git Commit Message Examples: 50+ Real-World Templates
Need inspiration for your next commit message? This guide provides 50+ real-world examples following the Conventional Commits format — the most widely adopted commit message standard.
Each example is based on actual commits from production codebases. Copy these templates, adapt them to your project, and maintain a clean, consistent git history.
Feature Commits
Feature commits add new functionality. Use `feat` as the type.
1. User Authentication
```
feat(auth): add OAuth2 login with Google
Implement Google OAuth2 authentication flow. Users can now sign in
with their Google account. Added callback handler and session management.
Closes #234
```
2. Search Functionality
```
feat(search): add full-text search for products
Implemented full-text search using PostgreSQL tsvector. Search results
now include products matching description text, not just titles.
Closes #456
```
3. File Upload
```
feat(upload): add drag-and-drop file upload
Users can now drag files directly into the upload area. Supports
multiple files, progress indicators, and automatic virus scanning.
Closes #567
```
4. Email Notifications
```
feat(email): add email notifications for order status changes
Customers receive email updates when their order status changes:
confirmed, shipped, delivered. Uses SendGrid API with HTML templates.
Closes #678
```
5. API Rate Limiting
```
feat(api): add rate limiting to public endpoints
Implemented rate limiting using Redis:
- 100 requests/minute for authenticated users
- 20 requests/minute for anonymous users
Returns 429 status with retry-after header when exceeded.
Closes #789
```
6. Dashboard Analytics
```
feat(dashboard): add analytics dashboard with charts
New analytics page showing:
- Daily active users
- Revenue over time
- Top products by sales
Uses Chart.js for visualization and aggregates data hourly.
Closes #890
```
7. Two-Factor Authentication
```
feat(auth): add two-factor authentication with TOTP
Users can enable 2FA using authenticator apps (Google Authenticator,
Authy). Generates QR code for setup and requires 6-digit code on login.
Closes #901
```
8. Webhook Integration
```
feat(integration): add webhook support for order events
Merchants can configure webhooks to receive real-time notifications
for order events: created, updated, cancelled, refunded.
Closes #123
```
9. Multi-Language Support
```
feat(i18n): add multi-language support with i18next
Application now supports English, Spanish, French, and German.
Language detection from browser settings with manual override option.
Closes #234
```
10. Export Functionality
```
feat(reports): add CSV and PDF export for reports
Users can export report data in CSV or PDF format. PDF includes
charts and formatted tables. CSV uses proper escaping for special
characters.
Closes #345
```
Bug Fix Commits
Bug fix commits correct incorrect behavior. Use `fix` as the type.
11. Payment Processing
```
fix(payment): handle expired credit cards gracefully
Previously, expired cards caused a 500 error during checkout.
Now we catch the Stripe error and show a user-friendly message
asking for updated payment information.
Fixes #456
```
12. Session Management
```
fix(auth): prevent session fixation attacks
Regenerate session ID after successful login to prevent session
fixation. Added secure flag to session cookies in production.
Fixes #567
```
13. Data Validation
```
fix(validation): accept plus addressing in email validation
Updated email regex to support plus addressing ([email protected]).
Previously these valid emails were rejected during signup.
Fixes #678
```
14. Race Condition
```
fix(cart): prevent duplicate items when clicking add button rapidly
Added debounce to add-to-cart handler. Previously, rapid clicks would
add the same item multiple times to the cart.
Fixes #789
```
15. Time Zone Handling
```
fix(events): correct event time display for different time zones
Events now display in the user's local time zone. Previously showed
server time, causing confusion for international users.
Fixes #890
```
16. Memory Leak
```
fix(streaming): close database connections after query completion
Fixed memory leak caused by unclosed database connections in streaming
endpoint. Connections are now properly released after use.
Fixes #901
```
17. XSS Vulnerability
```
fix(security): sanitize user input in comment rendering
Escape HTML entities in user comments to prevent XSS attacks.
Previously, raw HTML in comments could execute malicious scripts.
Fixes #123
```
18. Null Pointer
```
fix(profile): handle missing user profile data gracefully
Added null checks for optional profile fields. Previously caused
500 errors when users hadn't completed their profile.
Fixes #234
```
19. Concurrency Issue
```
fix(inventory): prevent overselling with database transactions
Added database transaction with row-level locking for inventory
updates. Previously, concurrent purchases could oversell items.
Fixes #345
```
20. API Response Format
```
fix(api): return consistent error response format
All API errors now return: { error: { code, message, details } }
Previously mixed formats made client error handling difficult.
Fixes #456
```
Documentation Commits
Documentation commits update docs without changing code. Use `docs` as the type.
21. README Update
```
docs(readme): add deployment instructions for AWS
Added step-by-step guide for deploying to AWS ECS. Includes IAM role
setup, task definition, and service configuration.
```
22. API Documentation
```
docs(api): add authentication examples
Added code examples for all authentication endpoints:
- Login with email/password
- Login with OAuth
- Refresh token
- Logout
```
23. Contributing Guide
```
docs(contributing): add code style guidelines
Documented code style conventions:
- ESLint configuration
- Prettier formatting rules
- Naming conventions
- File organization
```
24. Changelog
```
docs(changelog): add v2.0.0 release notes
Documented breaking changes, new features, and migration guide
for version 2.0.0 release.
```
25. Inline Comments
```
docs(auth): add JSDoc comments for authentication functions
Added comprehensive JSDoc for all auth functions including
parameter types, return values, and usage examples.
```
Refactoring Commits
Refactoring commits restructure code without changing behavior. Use `refactor` as the type.
26. Extract Module
```
refactor(api): extract validation logic into separate module
Moved request validation from route handlers into a dedicated
validator module. Improves testability and reduces duplication.
No behavior changes. All existing tests pass.
```
27. Simplify Logic
```
refactor(cart): simplify discount calculation logic
Replaced nested conditionals with lookup table. Discount rules
now defined in configuration object instead of if/else chains.
No behavior changes. All existing tests pass.
```
28. Rename Variables
```
refactor(utils): rename ambiguous variable names
Renamed variables for clarity:
- data → userProfile
- result → apiResponse
- temp → cachedValue
No behavior changes. All existing tests pass.
```
29. Remove Duplication
```
refactor(forms): extract common form validation logic
Created reusable form validation hooks. Removed 200+ lines of
duplicate validation code across 5 form components.
No behavior changes. All existing tests pass.
```
30. Improve Structure
```
refactor(project): reorganize directory structure
Moved files to feature-based directory structure:
- /features/auth
- /features/cart
- /features/products
No behavior changes. All existing tests pass.
```
Performance Commits
Performance commits improve speed or resource usage. Use `perf` as the type.
31. Database Index
```
perf(query): add database index for user lookups
Added composite index on (email, tenant_id) for user authentication
queries. Reduces query time from 450ms to 12ms.
Benchmark: 1000 concurrent logins, p95 latency reduced from 800ms to 45ms.
```
32. Caching
```
perf(api): add Redis caching for product listings
Cached product listing responses for 5 minutes. Reduces database
load by 80% for read-heavy endpoints.
Benchmark: Response time reduced from 320ms to 18ms for cached requests.
```
33. Bundle Size
```
perf(build): reduce bundle size by removing unused dependencies
Removed moment.js (replaced with date-fns) and lodash (using native
methods). Bundle size reduced from 2.1MB to 1.4MB.
Initial load time improved by 35%.
```
34. Query Optimization
```
perf(reports): optimize dashboard analytics query
Replaced multiple queries with single aggregation query. Dashboard
load time reduced from 4.2s to 0.8s.
Added EXPLAIN ANALYZE output to commit body for reference.
```
35. Image Optimization
```
perf(images): add automatic image optimization
Integrated sharp for image processing. Uploaded images are now:
- Resized to max 1920px width
- Converted to WebP format
- Compressed to 80% quality
Average image size reduced from 2.3MB to 180KB.
```
Test Commits
Test commits add or fix tests. Use `test` as the type.
36. Add Unit Tests
```
test(auth): add unit tests for password validation
Added tests for password validation rules:
- Minimum 8 characters
- At least one uppercase letter
- At least one number
- At least one special character
Coverage for auth module: 67% → 89%
```
37. Add Integration Tests
```
test(api): add integration tests for order flow
Added end-to-end tests for complete order flow:
- Create cart
- Add items
- Checkout
- Payment processing
- Order confirmation
Coverage for order module: 45% → 78%
```
38. Fix Failing Tests
```
test(cart): fix flaky cart timeout tests
Updated tests to use fake timers instead of real timeouts.
Tests now run deterministically and no longer fail intermittently.
Reduced test suite runtime from 45s to 12s.
```
39. Add E2E Tests
```
test(e2e): add Cypress tests for user registration
Added end-to-end tests for registration flow:
- Valid registration
- Duplicate email handling
- Password strength validation
- Email verification
Runs in CI on every PR.
```
40. Increase Coverage
```
test(utils): add tests for edge cases in utility functions
Added tests for:
- Empty array handling
- Null/undefined inputs
- Unicode characters
- Large datasets (>10000 items)
Overall coverage: 72% → 81%
```
CI/CD Commits
CI/CD commits update build and deployment configuration. Use `ci` as the type.
41. GitHub Actions
```
ci(github): add automated testing workflow
Added GitHub Actions workflow that:
- Runs on every PR
- Executes test suite
- Checks code coverage
- Posts coverage report as PR comment
```
42. Deployment Pipeline
```
ci(deploy): add automated deployment to staging
Added deployment pipeline:
- Triggered on merge to main
- Builds Docker image
- Pushes to container registry
- Deploys to staging environment
- Runs smoke tests
```
43. Environment Configuration
```
ci(env): add environment-specific configuration
Added separate configuration for:
- Development
- Staging
- Production
Secrets managed via environment variables. Configuration validated
at startup.
```
44. Docker Setup
```
ci(docker): add multi-stage Docker build
Optimized Dockerfile with multi-stage build:
- Build stage: installs all dependencies
- Production stage: only runtime dependencies
Image size reduced from 1.2GB to 180MB.
```
45. Monitoring
```
ci(monitoring): add health check endpoint
Added /health endpoint that checks:
- Database connectivity
- Redis connectivity
- External API availability
Used by load balancer for health monitoring.
```
Breaking Changes
Breaking changes require special notation. Use `!` after type/scope or add BREAKING CHANGE footer.
46. API Response Format Change
```
feat(api)!: change user endpoint response format
BREAKING CHANGE: The /api/users endpoint now returns an array
instead of an object with a data property. Update all clients
to handle the new response format.
Migration: Replace response.data with response directly.
```
47. Authentication Method Change
```
feat(auth)!: switch from JWT to session-based authentication
BREAKING CHANGE: Removed JWT token authentication. All clients
must now use session cookies. Update authentication flow in
client applications.
Migration guide: docs/migration/v2-authentication.md
```
48. Database Schema Change
```
feat(database)!: rename users table to accounts
BREAKING CHANGE: The users table has been renamed to accounts.
Update all SQL queries and ORM models to use the new table name.
Migration: Run db:migrate to apply schema changes.
```
49. Configuration Format Change
```
feat(config)!: change configuration file format from JSON to YAML
BREAKING CHANGE: Configuration files must now be in YAML format.
JSON configuration files are no longer supported.
Migration: Convert config.json to config.yaml using the provided
migration script: scripts/migrate-config.sh
```
50. Removed Deprecated Features
```
feat(api)!: remove deprecated v1 endpoints
BREAKING CHANGE: Removed all /api/v1/* endpoints that were
deprecated in v1.5.0. Use /api/v2/* endpoints instead.
Migration: Update API client to use v2 endpoints. See migration
guide: docs/migration/v2-api.md
```
Generate These Automatically
Writing commit messages following these patterns takes time. The Git Commit Message Generator analyzes your staged changes and generates commit messages in Conventional Commits format automatically.
How it works:
1. Stage your changes: `git add .`
2. Get your diff: `git diff --cached`
3. Paste into the generator
4. Review the suggested message
5. Edit if needed, then commit
It's free, runs in your browser, and helps you maintain consistent, high-quality commit messages across your team.
Benefits:
- Consistency: Every message follows Conventional Commits format
- Speed: Generate messages in seconds, not minutes
- Quality: AI suggests descriptive, specific messages based on your actual changes
Related Articles
- How to Write Better Git Commit Messages
- Git Commit Message Format Reference
- Conventional Commits Best Practices
---
*Ready to write better commit messages faster? Try the Git Commit Message Generator — it generates Conventional Commits format messages automatically from your changes.*