Generate meaningful commit messages using OpenAI's GPT models. Support for multiple profiles, interactive reviews, and seamless Git integration.
View the live project or repository
aicommit is a Node.js-based command-line interface (CLI) tool that integrates with Git and OpenAI's language models to automate the commit message creation process. It analyzes staged changes in your repository and generates appropriate, context-aware commit messages that follow best practices.
Beyond simple message generation, the tool supports multiple configuration profiles, allowing you to maintain different settings for various projects or teams, interactive message review for quality control, and seamless integration with your existing Git workflow.
The core functionality of aicommit lies in its ability to understand your code changes and generate relevant commit messages. By utilizing OpenAI's powerful language models like GPT-4o-mini, the tool creates messages that:
- Accurately describe what changed
- Follow consistent formatting conventions
- Include appropriate technical detail
- Save you time and mental effort
One of the standout features I implemented is the ability to maintain multiple profiles, each with its own:
- OpenAI API key
- Language model selection
- System message prompt
- Review preferences
- Temperature and token settings
This allows you to easily switch between different configurations for personal projects, work assignments, or specific team requirements without repeatedly adjusting settings.
Quality control remains important, which is why aicommit offers an interactive review process where you can:
- Accept the generated message as-is
- Refine the suggested message
- Request a completely new message generation
This review functionality ensures that while the process is automated, you maintain full control over your commit history.
The tool seamlessly integrates with your existing Git workflow, offering:
- Automatic staging of changes
- Commit message generation
- Optional automatic pushing
- Verbose output option for detailed logs
- Simple command-line flags for quick configuration changes
Under the hood, aicommit combines several technologies:
- Node.js as the runtime environment
- OpenAI API for language model integration
- simple-git for Git operations within JavaScript
- commander for command-line argument parsing
- @inquirer/prompts for interactive user interfaces
The application follows a modular design pattern, separating concerns between profile management, OpenAI interaction, Git operations, and the CLI interface.
Getting started with aicommit is straightforward:
npm i -g @fede91/aicommit
After installation, you'll need to set up at least one profile:
aicommit --add-profile myprofile
aicommit --set-api-key YOUR_OPENAI_API_KEY
aicommit --set-model gpt-4o-mini
You can customize the system message to guide how the AI generates commit messages:
aicommit --set-system-message "Generate concise, descriptive Git commit messages focusing on what changes were made and why."
Here's how aicommit has transformed my daily development workflow:
1. I make code changes and am ready to commit
2. Instead of manually staging and crafting a commit message, I simply run:
aicommit
3. The tool automatically stages my changes, analyzes them, and generates a commit message
4. I review the suggested message, potentially refine it, and confirm
5. The changes are committed and optionally pushed automatically
This streamlined process saves me several minutes per commit, which adds up significantly throughout a development day.
One aspect I'm particularly proud of is the level of customization available:
- Temperature control (0.0-1.0) to adjust creativity vs. predictability
- Token limits to control message length
- Timeout settings for API requests
- Verbose mode for detailed operation logs
- Auto-push toggle to automatically push after committing
Each of these settings can be adjusted globally or per profile, giving you precise control over the tool's behavior.
As I continue to develop aicommit, I'm considering several enhancements:
- Support for additional AI providers beyond OpenAI
- Pre-commit hooks for automated quality checks
- Team collaboration features for shared profiles
- Commit message templates and style guides
- History analysis for personalized suggestions
I welcome contributions and feedback from the developer community to make aicommit even more powerful.
Check out the GitHub repository to learn more, contribute, or provide feedback on this project.
Made with 🤍 by @Me