- Simplified README.md by moving detailed command docs, workflows, and development info to dedicated user-guide/ and developer-guide/ directories. - Created index.md files for both guides to improve navigation. - Extracted individual command guides (e.g., chat.md, edit.md) into user-guide/ for focused, maintainable documentation. - Moved architecture, configuration, and troubleshooting to developer-guide/. - Updated README links to point to the new docs structure.
2.3 KiB
2.3 KiB
📝 Commit Message Guide
The commit-msg command generates a conventional commit message based on your currently staged changes. Unlike the commit command, it only outputs the suggested message without actually performing the git commit.
Why use Commit Message?
- Consistency: Automatically generate messages following the Conventional Commits specification (e.g.,
feat(api): add JWT authentication). - Convenience: Quickly get a descriptive summary of your changes without manually reviewing the diff.
- Workflow flexibility: Useful when you want to review, edit, or use the generated message in a custom git command or GUI.
Basic Usage
git add .
grokkit commit-msg # Generate message only
grokkit commit-msg -m grok-4 # Use specific model
Output format: type(scope): subject\n\nbody
Options
| Flag | Description |
|---|---|
--model, -m |
Override the default model (e.g., grok-4) |
How it Works
- Diff Retrieval: Grokkit runs
git diff --cached --no-colorto get all staged changes. - AI Analysis: It sends the diff to Grok with instructions to generate a conventional commit message.
- Streaming Output: The generated message is streamed directly to your terminal.
Workflow Example
- Stage your changes:
git add main.go internal/grok/client.go - Generate the message:
grokkit commit-msg - Use the output to commit:
git commit -m "$(grokkit commit-msg)"
Comparison with commit command
| Feature | commit-msg |
commit |
|---|---|---|
| Generates AI message | Yes | Yes |
| Shows diff-based summary | Yes | Yes |
| Asks for confirmation | No | Yes |
Performs git commit |
No | Yes |
| Use case | Scripting / Manual control | Interactive git workflow |
Best Practices
- Stage only related changes: To get the most accurate commit message, stage only the changes that belong to a single logical unit of work.
- Review the output: AI-generated messages are usually good but may need minor tweaks for complex changes.
- Model Choice: Use a reasoning model (
grok-4) for complex architectural changes to get more detailed body descriptions in the commit message.