A good commit message should be descriptive and provide context about the changes made. This helps improve code review, debugging, and long-term maintainability.
Use the following format for commit messages:
<type>(<scope>): <short message> (optional issue references)The <type> field indicates the nature of the changes made in the commit. Use one of the following values:
| Type | Description |
|---|---|
| feat | A new feature or enhancement to existing functionality. |
| fix | A bug fix or correction of an issue. |
| docs | Documentation updates (e.g., README, code comments). |
| style | Code style changes (e.g., formatting, indentation, no logic). |
| refactor | Code refactoring without changing external behavior. |
| perf | Performance improvements. |
| test | Adding or modifying tests. |
| chore | Routine tasks, maintenance, or tooling changes. |
The <scope> is optional, but recommended. It helps clarify which part of the project the commit affects. For example:
| Scope | Description |
|---|---|
| repo | Project-wide configuration or setup |
| config | Build scripts, environment, or settings |
| auth | Authentication logic or features |
| api | API endpoints or integrations |
| ui | User interface components or styling |
| db | Database models or queries |
A concise summary of what the commit does.
- Use the imperative mood (e.g., “Add” not “Added”)
- Capitalize the first letter
- Don’t end with a period
- Keep under 50 characters if possible
- Be specific (e.g., “Add agent tools” > “Update code”)
- Avoid "I", "this commit", or "fix" as vague verbs
<type>(<scope>): <short message> (optional issue references)
<BLANK LINE>
<optional longer description>Example:
feat(api): Add login endpoint (fixes #12)
This adds a new login endpoint to the API that allows users to authenticate using their email and password.Use GitHub issue references to link commits to issues.
<action> #<issue_number>fixes #123– closes the issue on mergerefs #123– just links the issue
fix(auth): Prevent session expiration bug (fixes #42)
docs(repo): Update contribution guide (refs #17)| Purpose | Example Commit Message | Result |
|---|---|---|
| Close single issue | fix(ui): Resolve button alignment issue (fixes #12) |
Links & closes issue #12 |
| Reference single issue | docs(config): Clarify setup instructions (refs #34) |
Links issue #34 only |
| Close multiple issues | feat(api): Add user registration endpoint (fixes #56, #57) |
Links & closes issues #56, #57 |
| Reference multiple | refactor(db): Optimize query structure (refs #33, #38) |
Links only |
feat(api): Add login endpoint (fixes #12)
This adds a new login endpoint to the API that allows users to authenticate using their email and password.