GitHub commit naming convention

Table of content

If you are looking to create your own GitHub project or contribute to an existing one, understanding commit naming conventions is essential.

Commit naming convention


1. Use a Consistent Format

Maintaining a consistent commit message format improves readability and collaboration.

Standard Format:

1<type>(<scope>): <description>
2<type>: <description>

✅ Example:

1feat(auth): add JWT authentication
2fix(ui): resolve button alignment issue

2. Common Commit Types

TypeDescription
featIntroduces a new feature
fixFixes a bug
docsUpdates documentation
styleCode style changes (whitespace, formatting, missing semicolons)
refactorCode restructuring without changing behavior
perfImproves performance
testAdds or updates tests
choreMaintenance tasks (e.g., package updates, build process changes)
ciCI/CD-related changes

3. Writing Clear Commit Messages

Use the imperative mood:

1"fix(login): handle null password error"
2"fixed issue with null password"

Keep It Concise:

✅ Limit subject lines to 50 characters.

✅ Use present tense (e.g., "fix" instead of "fixed").

✅ Wrap the body at 72 characters per line if additional context is needed.

✅ Keep commits small and focused—avoid committing thousands of lines at once.

✅ Avoid committing large changes (e.g., 10,000 lines or 100 files) as they are difficult to review.

4. Writing Meaningful Commit Messages

✅ Good example:

1feat(api): add rate limiting to prevent abuse

Added an IP-based rate-limiting mechanism using Redis to throttle requests and prevent abuse. This will help improve API reliability under high traffic conditions.

Avoid Generic Commit Messages

❌ Bad Examples:

1update
2fix bug
3refactor stuff

✅ Better Alternatives:

1fix(auth): correct token expiration logic
2chore(deps): update React to v18

5. Use Conventional Commits

If your project follows Semantic Versioning, use the Conventional Commits helps automate versioning and changelogs.

1feat!: introduce breaking change to API

The "!" indicates a breaking change.

6. Optional: Add Emojis for Readability

Some teams use emojis to make commit logs visually appealing.

Example:

1✨ feat(auth): add OAuth login
2🐛 fix(ui): resolve dropdown bug
3📚 docs(readme): update installation steps

8. Summary

By following these commit message conventions, you ensure:

✅ Clear history

✅ Easier collaboration

✅ Better automation (e.g., changelog generation, release management)

Adopting a structured commit naming convention will make your codebase more maintainable and improve teamwork efficiency.