Your First Commit with /commit¶
Learn how to create professional git commits using the git-workflow plugin's /commit command.
Duration: 5 minutes
Level: Beginner
Plugin: git-workflow
What You'll Learn¶
- How to use the
/commitcommand - Understanding pre-commit checks
- Emoji conventional commit format
- Best practices for commit messages
Prerequisites¶
- Git repository initialized
- git-workflow plugin installed
- Changes staged or unstaged in your repository
Step 1: Make Some Changes¶
First, make some changes to your code:
| Bash | |
|---|---|
Step 2: Use /commit Command¶
In Claude Code, simply type:
| Bash | |
|---|---|
Claude will:
- Analyze your changes - Review staged and unstaged files
- Run pre-commit checks - Execute relevant tests and linters
- Suggest commit message - Generate emoji conventional commit
- Stage and commit - Complete the commit process
Step 3: Review Pre-Commit Checks¶
The /commit command automatically runs checks based on your project type:
Step 4: Understand Commit Message Format¶
The /commit command uses Emoji Conventional Commits:
| Text Only | |
|---|---|
Common Commit Types¶
| Emoji | Type | Usage |
|---|---|---|
| ✨ | feat | New features |
| 🐛 | fix | Bug fixes |
| 📚 | docs | Documentation changes |
| 💎 | style | Code formatting |
| ♻️ | refactor | Code restructuring |
| ⚡ | perf | Performance improvements |
| 🧪 | test | Testing |
| 🔧 | chore | Build/tools/config |
Step 5: Review and Confirm¶
Claude will show you:
- Files changed - What will be committed
- Pre-commit results - All checks passed/failed
- Suggested commit message - Emoji conventional format
- Confirmation prompt - Approve or modify
Example output:
| Text Only | |
|---|---|
Step 6: Complete the Commit¶
Type yes to confirm, and Claude will:
- Stage all changes (if not already staged)
- Create the commit with the message
- Show commit hash and summary
| Text Only | |
|---|---|
Advanced Options¶
Skip Pre-Commit Checks¶
If you need to commit quickly without checks:
| Bash | |
|---|---|
Use Sparingly
Skipping checks can lead to broken builds. Only use when necessary.
Skip Tests Only¶
Run linters but skip time-consuming tests:
| Bash | |
|---|---|
Use Professional Workflow Skill¶
For ~70% faster commits with the professional-commit-workflow skill:
| Bash | |
|---|---|
Best Practices¶
✅ Do¶
- Write clear descriptions - Explain what and why
- Use imperative mood - "Add feature" not "Added feature"
- Keep commits focused - One logical change per commit
- Run pre-commit checks - Catch issues early
- Review changes - Verify what you're committing
❌ Don't¶
- Commit broken code - Always ensure tests pass
- Mix unrelated changes - Keep commits focused
- Skip pre-commit checks - Unless absolutely necessary
- Use vague messages - "Fix stuff" is not helpful
- Commit sensitive data - Check for secrets/credentials
Troubleshooting¶
Pre-Commit Checks Fail¶
Problem: Tests or linters fail during pre-commit.
Solution:
- Review the error messages
- Fix the issues in your code
- Run
/commitagain
Wrong Commit Type Suggested¶
Problem: Claude suggests wrong commit type.
Solution:
- When prompted, modify the commit message
- Choose the correct type from the list
- Provide a better description
Changes Not Detected¶
Problem: /commit doesn't see your changes.
Solution:
- Verify changes exist:
git status - Ensure you're in the repository root
- Check if files are ignored in
.gitignore
What's Next?¶
Now that you've mastered basic commits, try:
- Create Your First PR - Learn pull request workflow
- PRD-Based Workflow - Plan before coding
- Plugin Catalog - Explore other plugins
Related Resources¶
- Git Workflow Plugin - Full plugin documentation
- Conventional Commits Reference - Complete commit type list
- Contributing Guide - Contribute to this project