Skip to content

πŸ“‹ Practical guidelines for writing clear, consistent Git commit messages with emoji-based formatting. Includes comprehensive templates, real-world examples, and automated setup scripts to help developers at any level write well-structured, standardized commits that improve code collaboration and project history.

License

Notifications You must be signed in to change notification settings

mikoflip/git-commit-guidelines

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Git Commit Guidelines

A comprehensive guide to writing consistent, meaningful git commit messages that improve code collaboration and project history.

πŸš€ Why Use Standardized Commit Messages?

  • 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

πŸ“– Quick Start

Most Common Patterns

πŸš€ 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

Format

<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 !.

🌟 Examples in the Wild

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

πŸ“ Complete Commit Examples

Example 1: Simple one-line commit

πŸ“ docs: Update README with installation instructions

Example 2: Feature with body and issue linking

πŸš€ 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

Example 3: Bug fix with breaking change

πŸ› 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

🎯 Quick Reference Tables

Project Management

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> -

Implementation

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>

Bug Fixes

Focus Update
Bugfixes πŸ› fix: Update <component> to fix <issue>
Hotfixes πŸ”₯ hotfix: Update <component> to hotfix <issue>

See complete guidelines for all categories and examples.

πŸ› οΈ Installation

1. Set Up Commit Message Template

# Copy the template to your project
cp templates/.gitmessage .gitmessage

# Configure git to use it
git config commit.template .gitmessage

2. Automated Setup (Recommended)

# Run the setup script
chmod +x templates/setup-git-template.sh
./templates/setup-git-template.sh

3. Manual Configuration

git config commit.template .gitmessage
git config core.editor "code --wait"  # For VS Code
# git config core.editor "vim"        # For Vim

πŸ“š Complete Guide

For the full guide with all commit types, examples, and best practices, see: Git Commit Guidelines

πŸ“ Repository Structure

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

🀝 Contributing

We welcome improvements to this guide! Please:

  1. Read the complete guidelines first
  2. Open an issue to discuss major changes
  3. Follow the commit guidelines in this guide for your contributions

πŸ“„ License

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.

πŸ€– Development Transparency

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.

About

πŸ“‹ Practical guidelines for writing clear, consistent Git commit messages with emoji-based formatting. Includes comprehensive templates, real-world examples, and automated setup scripts to help developers at any level write well-structured, standardized commits that improve code collaboration and project history.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages