name: git-commit description: Create a well-formatted git commit with conventional commit message format and ticket reference
Git Commit
Create a git commit following the conventional commits specification with Linear ticket reference.
Commit Message Format
{type}({scope}): {description}
{body}
Refs: {ticket-id}
Type
| Type | Description |
|---|---|
feat |
New feature |
fix |
Bug fix |
refactor |
Code refactoring |
docs |
Documentation only |
test |
Adding/updating tests |
chore |
Maintenance, deps, tooling |
perf |
Performance improvement |
style |
Code style (formatting, semicolons) |
ci |
CI/CD changes |
Scope
Optional, indicates the component affected:
api- Backend API changesmobile- Mobile app changesinfra- Infrastructure/Terraform changesshared- Shared libraries/utilities- Or a specific feature name
Description
- Imperative mood ("add" not "added")
- No period at the end
- Max 72 characters
- Lowercase first letter
Body
- Explain WHAT and WHY (not how)
- Wrap at 72 characters
- Separate from subject with blank line
Steps
Get authenticated identity for commit attribution (recommended):
- If a GitHub MCP server is available, call the
get_authenticated_usertool (GitHub App) orget_metool (PAT/official MCP) - This returns the bot/user identity (
nameandemail) to use for commits - If the tool is unavailable or fails, proceed with default git config (graceful fallback)
- If a GitHub MCP server is available, call the
Stage changes:
git add -AOr stage specific files if making focused commits:
git add path/to/file1 path/to/file2Review staged changes:
git diff --staged --statCreate commit:
If authenticated identity was retrieved, use environment variables to set both author and committer:
GIT_AUTHOR_NAME="{name}" GIT_AUTHOR_EMAIL="{email}" GIT_COMMITTER_NAME="{name}" GIT_COMMITTER_EMAIL="{email}" git commit -m "{type}({scope}): {description}" -m "{body}" -m "Refs: {ticket-id}"Example with bot identity:
GIT_AUTHOR_NAME="my-app[bot]" GIT_AUTHOR_EMAIL="123456+my-app[bot]@users.noreply.github.com" GIT_COMMITTER_NAME="my-app[bot]" GIT_COMMITTER_EMAIL="123456+my-app[bot]@users.noreply.github.com" git commit -m "feat(api): add endpoint" -m "Add new endpoint for user authentication" -m "Refs: STU-15"If no authenticated identity (fallback), use standard commit:
git commit -m "{type}({scope}): {description}" -m "{body}" -m "Refs: {ticket-id}"
Examples
Feature Commit
feat(api): add user authentication endpoint
Implement JWT-based authentication with refresh tokens.
Includes rate limiting and brute force protection.
Refs: STU-15
Bug Fix Commit
fix(mobile): resolve login timeout issue
Increase timeout from 5s to 30s for slow networks.
Add retry logic with exponential backoff.
Refs: STU-23
Test Commit
test(api): add integration tests for auth endpoints
Cover login, logout, and token refresh flows.
Add edge cases for invalid credentials.
Refs: STU-15
Validation
Before committing:
- Ensure all tests pass
- Ensure linting passes
- Review the diff to confirm changes are intentional
After committing:
git log -1 --oneline
Report the commit hash to confirm success.