gitcommit: A Smarter Way to Write Git Messages
By Mark Fletcher
- 2 minutes read - 234 wordsI recently developed a new open-source tool called gitcommit
to streamline the process of writing Git commit messages. This command-line assistant leverages Claude AI to analyze your staged changes and suggest clear, descriptive commit messages that adhere to best practices.
Key Features:
- Contextual Analysis: Evaluates your staged changes to understand the context.
- Message Suggestions: Provides well-formatted commit message recommendations.
- Interactive Workflow: Allows you to accept the suggested message, edit it in Vim, or request a new suggestion.
- Comprehensive Committing: Supports committing all changes with the
-a
flag. - Validation: Ensures that edited messages meet formatting standards.
Installation:
To install gitcommit
, execute:
go install github.com/wingedpig/gitcommit@latest
Setup:
Obtain an API key from Anthropic at https://console.anthropic.com/. Then, set your API key:
export CLAUDE_API_KEY=your_api_key_here
Usage:
Show Help:
gitcommit -help
Commit Staged Changes:
gitcommit
Commit All Changes (Including Unstaged):
gitcommit -a
When you run gitcommit
, it will prompt you for an initial commit message, analyze the changes, and suggest an improved message. You can then choose to accept, edit, or reject the suggestion.
gitcommit
is released under the MIT License. Contributions are welcome; feel free to open issues or submit pull requests.
You can find the project on GitHub: https://github.com/wingedpig/gitcommit
I hope this tool proves helpful in your development workflow.