Git Commit Helper
Quick start
Analyse staged changes and generate a commit message:
bash
git diff --staged
Commit message format
Follow conventional commits format:
code
<type>(<scope>): <description> [optional body] [optional footer]
Types
- •feat: New feature
- •fix: Bug fix
- •docs: Documentation changes
- •style: Code style changes (formatting, missing semicolons)
- •refactor: Code refactoring
- •test: Adding or updating tests
- •chore: Maintenance tasks
Example
code
feat(auth): add JWT authentication Implement JWT-based authentication system with: - Login endpoint with token generation - Token validation middleware - Refresh token support
For more examples (bugfix, refactor, multi-file, breaking changes, scopes), see
references/examples.md.
Commit message guidelines
DO:
- •Use imperative mood ("add feature" not "added feature")
- •Keep first line under 50 characters
- •Capitalise first letter
- •No period at end of summary
- •Explain WHY not just WHAT in body
DON'T:
- •Use vague messages like "update" or "fix stuff"
- •Include technical implementation details in summary
- •Write paragraphs in summary line
- •Use past tense
Template workflow
- •Review changes:
git diff --staged - •Identify type: Is it feat, fix, refactor, etc.?
- •Determine scope: What part of the codebase?
- •Write summary: Brief, imperative description
- •Add body: Explain why and what impact
- •Note breaking changes: If applicable
For git commands (analysing diffs, interactive staging, amending commits), see
references/git-commands.md.
Best practices
- •Atomic commits - One logical change per commit
- •Test before commit - Ensure code works
- •Reference issues - Include issue numbers if applicable
- •Keep it focused - Don't mix unrelated changes
- •Write for humans - Future you will read this
Commit message checklist
- • Type is appropriate (feat/fix/docs/etc.)
- • Scope is specific and clear
- • Summary is under 50 characters
- • Summary uses imperative mood
- • Body explains WHY not just WHAT
- • Breaking changes are clearly marked
- • Related issue numbers are included
References
- •
references/examples.md- Detailed commit message examples (feature, bugfix, refactor, multi-file, breaking changes, scope examples) - •
references/git-commands.md- Git commands for analysing changes, interactive staging, and amending commits