A comprehensive guide to writing consistent, meaningful git commit messages that improve code collaboration and project history.
- Clear History: Easy to understand what changed and why
- Better Collaboration: Team members can quickly grasp changes
- Automated Tools: Enable automated changelog generation and semantic versioning
- Faster Reviews: Reviewers can understand changes at a glance
- Better Debugging: Easier to track down when issues were introduced
π feat: Add user authentication
π fix: Update LoginForm to fix validation error
π docs: Update API documentation
β
test: Add tests for PaymentService
β»οΈ refactor: Update UserService for better performance<emoji> <scope>[!]: <description>
[Optional <body>: explain the what and why]
[Optional <footer>: describe breaking changes and link issues]
Note: Use ! after scope for breaking changes (e.g., feat!:). Always include BREAKING: in footer when using !.
Real commits using these guidelines:
π feat: Add OAuth integration for GitHub login
π feat!: Remove deprecated API endpoints BREAKING: Remove /v1/users endpoint
π fix: Update UserService to handle null email addresses
π docs: Add deployment guide for AWS environments
β
test: Add integration tests for payment workflow
β»οΈ refactor: Update database queries for better performance
π security: Update JWT validation to prevent replay attacksπ docs: Update README with installation instructions
π feat: Add user authentication system
- Add JWT token generation and validation
- Add login/logout endpoints with session management
- Add password encryption using bcrypt
This enables secure user access and prepares for role-based
permissions in the next release.
closes #123
refs #456
π fix!: Update API response format for error handling
Change error response from string to object format to provide
more detailed error information including error codes and
suggested actions for client applications.
BREAKING: Error responses now return objects instead of strings
fixes #789
| Focus | Add | Update | Remove |
|---|---|---|---|
| Features | π feat: Add <feature> |
π feat: Update <feature> for <benefits> |
π feat: Remove <feature> |
| Breaking Changes | π feat!: Add <feature> BREAKING: <description> |
π feat!: Update <feature> BREAKING: <description> |
π feat!: Remove <feature> BREAKING: <description> |
| Releases | π·οΈ release: Add <feature> |
π·οΈ release: Update to <release> |
- |
| Focus | Add | Update | Remove |
|---|---|---|---|
| Components | π feat: Add <component> |
π feat: Update <component> |
π feat: Remove <component> |
| Tests | β
test: Add tests for <component> |
β
test: Update tests |
β
test: Remove tests |
| Dependencies | π¦ deps: Add <dep> |
π¦ deps: Update <dep> to <version> |
π¦ deps: Remove <dep> |
| Focus | Update |
|---|---|
| Bugfixes | π fix: Update <component> to fix <issue> |
| Hotfixes | π₯ hotfix: Update <component> to hotfix <issue> |
See complete guidelines for all categories and examples.
# Copy the template to your project
cp templates/.gitmessage .gitmessage
# Configure git to use it
git config commit.template .gitmessage# Run the setup script
chmod +x templates/setup-git-template.sh
./templates/setup-git-template.shgit config commit.template .gitmessage
git config core.editor "code --wait" # For VS Code
# git config core.editor "vim" # For VimFor the full guide with all commit types, examples, and best practices, see: Git Commit Guidelines
git-commit-guidelines/
βββ README.md # This file
βββ git-commit-guidelines.md # Complete commit guidelines
βββ templates/
β βββ .gitmessage # Git commit message template
β βββ setup-git-template.sh # Quick setup script
βββ LICENSE # CC BY 4.0 License
We welcome improvements to this guide! Please:
- Read the complete guidelines first
- Open an issue to discuss major changes
- Follow the commit guidelines in this guide for your contributions
This work is licensed under Creative Commons Attribution 4.0 International License. You're free to use and adapt this guideβjust provide attribution when you do!
Start writing better commits today! Check out the complete guide and set up the templates to get started.
This project was developed through human-AI collaboration with Claude Code by Anthropic. The vision, structure, and decisions were human-driven, while AI collaboration enhanced content organization, documentation quality, and technical implementation to ensure comprehensive coverage and professional presentation.