| name | Git Commit Conventions |
| description | Conventional commit format and workflow with Jira ticket integration |
Git Commit Conventions
Guidelines for creating properly formatted commit messages with Jira ticket numbers.
Configuration
Set your Jira project prefix in README.md:
# Project Configuration
- **Jira Ticket Prefix**: `PROJ` (e.g., JIRA, DEV, TASK)
- **Branch Format**: `<PREFIX>-<number>-description`
Conventional Commit Format
<type>: <PREFIX>-<ticket-number> <description>
Where:
<type> = Commit type (feat, fix, docs, etc.)
<PREFIX> = Your Jira project prefix (PROJ, JIRA, etc.)
<ticket-number> = Jira ticket number
<description> = Imperative description
No-ticket exception
If there is no ticket in the branch name and recent commits do not include tickets, omit the ticket and use:
<type>: <description>
Commit Types
| Type | Usage |
|---|
feat | A new feature |
fix | A bug fix |
docs | Documentation only changes |
style | Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) |
refactor | A code change that neither fixes a bug nor adds a feature |
perf | A code change that improves performance |
test | Adding missing tests or correcting existing tests |
build | Changes that affect the build system or external dependencies |
ci | Changes to our CI configuration files and scripts |
chore | Other changes that don't modify src or test files |
revert | Reverts a previous commit |
rollback | Rolling back to a previous version |
Message Guidelines
- Use imperative mood in the description (e.g., "Add feature" not "Added feature")
- Keep the description concise but descriptive
- Capitalize the first letter of the description
- Do not end with a period
Ticket Number Format
- Always include the Jira ticket number from your current branch
- Extract the ticket number from your branch name
- Example:
PROJ-134713-FE-Add-GitHub-unittest.instructions.md-for-vitest → PROJ-134713
- Example:
TASK-456-implement-user-auth → TASK-456
- If the branch has no ticket and recent commits do not include tickets, omit the ticket and use
<type>: <description>.
Examples
git commit -m "feat: PROJ-134713 Add GitHub unittest instructions for Vitest best practices"
git commit -m "feat: TASK-456 Implement user authentication flow"
git commit -m "fix: PROJ-134714 Resolve memory leak in component unmounting"
git commit -m "fix: JIRA-789 Correct email validation regex"
git commit -m "docs: PROJ-134715 Update API documentation for user service"
git commit -m "refactor: PROJ-134716 Simplify user authentication logic"
git commit -m "rollback: PROJ-134717 Revert to previous version due to performance issues"
git commit -m "test: PROJ-134718 Add unit tests for UserProfile component"
git commit -m "perf: PROJ-134719 Optimize database query for user search"
AI Assistant Workflow
When user says "commit the changes" or similar:
Step-by-step process:
- ✅ Run
git status to see modified files
- ✅ Run
git diff --staged (or git diff if nothing staged) to review actual code changes
- CRITICAL: This step is mandatory - never skip it
- ✅ Analyze the actual code changes in detail (not just filenames)
- ✅ Check if changes should be split into multiple commits
- If staged changes contain multiple unrelated changes (e.g., feature + refactor + docs):
- STOP and inform the user
- Recommend unstaging:
git reset HEAD <file>
- Suggest staging related changes separately
- Example: "Your staged changes include both feature changes and documentation updates. Consider splitting these into separate commits for better history."
- Each commit should represent one logical change
- ✅ Determine the appropriate commit type based on what actually changed:
- New functionality →
feat
- Bug fixes →
fix
- Tests only →
test
- Documentation →
docs
- Code cleanup/restructuring →
refactor
- Performance improvements →
perf
- Build/CI changes →
build or ci
- ✅ Extract the ticket number from the current branch name
- Read project's Jira prefix from
README.md if available
- Or detect from branch name pattern (e.g.,
PROJ-, TASK-, etc.)
- If no ticket is present and recent commits do not include tickets, omit the ticket
- ✅ Check recent commit messages to match local conventions (e.g., whether tickets are included)
- ✅ Generate a properly formatted commit message based on actual changes
- ✅ Execute the commit with the generated message (only if changes are cohesive)
Atomic Commits
Each commit should represent ONE logical change:
✅ Good - Focused commits:
git add src/components/UserProfile.tsx
git commit -m "feat: PROJ-12345 Add user avatar display to UserProfile"
git add src/utils/validation.ts
git commit -m "fix: PROJ-12345 Correct email validation regex"
git add README.md
git commit -m "docs: PROJ-12345 Update UserProfile component documentation"
❌ Bad - Mixed changes:
git add src/components/UserProfile.tsx src/utils/validation.ts README.md
git commit -m "feat: PROJ-12345 Add avatar, fix validation, update docs"
When to split commits:
- Changes serve different purposes (feature vs fix vs refactor)
- Changes affect unrelated areas of the codebase
- One change could be reverted independently
- Changes would have different commit types
DO NOT:
- ❌ Create commit messages based only on
git status output
- ❌ Assume what changed based on filenames alone
- ❌ Skip reviewing the actual code diff
- ❌ Guess the commit type without seeing the changes
- ❌ Commit multiple unrelated changes together
- ❌ Mix different commit types in a single commit (e.g., feat + refactor + docs)
User Prompts
Recommended Prompts
Best (let AI analyze):
"Commit the changes"
"Review my staged changes and create a commit message"
Good (with context):
"I've updated the authentication flow and added error handling.
Check my changes and create a commit message."
Acceptable (manual description):
"Create a commit message. I added unit tests for the UserProfile component
and fixed a bug in the validation logic."
Example Workflow
- Make your code changes
- Stage your changes:
git add .
- Ask the AI assistant: "Commit the changes"
- The assistant will:
- Execute the commit:
git commit -m "feat: PROJ-134801 Add error handling to authentication flow"