AI-driven CLI tool that generates optimal, context-aware commit messages, streamlining your version control process with precision and efficiency
Explore the docs »
Report Bug
·
Request Feature
Commitron is a CLI tool that generates AI-powered commit messages based on your staged changes in a git repository.
- 🤖 Uses AI to generate meaningful commit messages
- 🔍 Analyzes your staged changes to understand what has been modified
- 🧩 Supports multiple AI providers:
- OpenAI (ChatGPT)
- Google Gemini
- Ollama (local inference)
- Anthropic Claude
- 📝 Supports various commit message conventions:
- No convention (plain text)
- Conventional Commits
- Custom templates
- ⚙️ Customizable settings via configuration file
When you run commitron
after staging some changes, you'll see output similar to this:
Generated Commit Message:
------------------------
feat(git): add support for detecting staged files and creating commits
Implement Git integration for detecting staged files and generating
commit messages based on the changes. This adds functionality to check
if the current directory is a Git repository, retrieve a list of staged
files, and create commits with AI-generated messages.
------------------------
Do you want to use this commit message? (y/n):
If you type y
, the commit will be created using the generated message.
# Add the tap directly from the commitron repository
brew tap stiliajohny/commitron https://github.com/stiliajohny/commitron.git
# Then install commitron
brew install commitron
# Clone the repository
git clone https://github.com/johnstilia/commitron.git
# Navigate to the directory
cd commitron
# Build and install
go install ./cmd/commitron
# Stage your changes
git add .
# Run commitron to generate a commit message
commitron
# Use with a custom config file
commitron --config /path/to/custom/config.yaml
# or using shorthand flags
commitron -c /path/to/custom/config.yaml
# Available commands
commitron generate # Generate a commit message (default command)
commitron init # Initialize a new configuration file
commitron version # Show version information
# Command options
commitron generate --dry-run # Preview without committing
commitron generate -d # Shorthand for --dry-run
commitron generate -c /path/to/config # Use custom config (shorthand)
commitron init --force # Overwrite existing config
commitron init -f # Shorthand for --force
commitron init -c /path/to/config # Initialize at custom location (shorthand)
# Get help for any command
commitron --help
commitron [command] --help
Commitron looks for a configuration file at ~/.commitronrc
. This is a YAML file that allows you to customize how the tool works.
Example configuration:
# AI provider configuration
ai:
provider: openai
api_key: your-api-key-here
model: gpt-3.5-turbo
# Commit message configuration
commit:
convention: conventional
include_body: true
max_length: 72
# Context settings for AI
context:
include_file_names: true
include_diff: true
max_context_length: 4000
See example.commitronrc for a complete example with all available options.
To use Commitron, you'll need API keys for your chosen AI provider:
- OpenAI: https://platform.openai.com/api-keys
- Google Gemini: https://aistudio.google.com/app/apikey
- Anthropic Claude: https://console.anthropic.com/keys
For Ollama, you need to have it running locally. See Ollama documentation for more information.
See LICENSE.txt for details.
See the open issues for a list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the GPLv3 License. See LICENSE
for more information.
John Stilia - stilia.johny@gmail.com