Git Commit
Create a git commit following the conventional commits specification with Linear ticket reference.
Commit Message Format
code
{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 changes - •
mobile- Mobile app changes - •
infra- Infrastructure/Terraform changes - •
shared- 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:
bashgit add -A
Or stage specific files if making focused commits:
bashgit add path/to/file1 path/to/file2
- •
Review staged changes:
bashgit diff --staged --stat
- •
Create commit:
If authenticated identity was retrieved, use environment variables to set both author and committer:
bashGIT_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:
bashGIT_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:
bashgit commit -m "{type}({scope}): {description}" -m "{body}" -m "Refs: {ticket-id}"
Examples
Feature Commit
code
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
code
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
code
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:
bash
git log -1 --oneline
Report the commit hash to confirm success.