Automatically generate Git commit messages using Gemini API
CommitBrew is a VS Code extension that analyzes your staged Git changes and generates meaningful commit messages using Google's Gemini AI. Say goodbye to "fix stuff" and "update code" commits!
- AI-Powered Commit Messages: Leverages Google's Gemini API to analyze your code changes
- Conventional Commit Format: Generates messages following conventional commit standards (feat:, fix:, docs:, etc.)
- Interactive Editing: Review and edit the generated message before committing
- One-Click Commit: Option to commit directly after generating the message
- Smart Analysis: Analyzes staged changes to understand the context of your modifications
- Zero Configuration: Automatically searches for API keys in multiple locations
- Open VS Code
- Go to Extensions (Ctrl+Shift+X)
- Search for "CommitBrew"
- Click Install
- Visit Google AI Studio
- Create a new API key
- Copy the key for the next step
Create a .env file in your project root or workspace:
GEMINI_API_KEY=your_gemini_api_key_hereNote: CommitBrew searches for the .env file in multiple locations:
- Current workspace root
- Extension directory
- Current working directory
- Parent directories
- Stage your changes: Use
git addto stage the files you want to commit - Open Command Palette: Press
Ctrl+Shift+P(orCmd+Shift+Pon Mac) - Run CommitBrew: Type "Generate Commit Message" and select the command
- Review & Edit: The AI-generated message will appear in an input box for review
- Commit: Choose to commit immediately or copy the message for later use
- Right-click in the Source Control panel and select "Generate Commit Message"
- Use the command from the Command Palette:
CommitBrew: Generate Commit Message
- Analysis: CommitBrew runs
git diff --cachedto analyze your staged changes - AI Processing: Sends the diff to Gemini API with a specialized prompt
- Format: Ensures the response follows conventional commit format
- Review: Presents the generated message for your review and editing
- Commit: Optionally commits the changes with the final message
- VS Code: Version 1.74.0 or higher
- Git: Must be installed and repository initialized
- Gemini API Key: Required for AI functionality
- Staged Changes: At least one file must be staged before generating commits
- Node.js 16.x or higher
- npm or yarn
- VS Code
# Clone the repository
git clone https://github.com/your-username/commitbrew.git
cd commitbrew
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Watch for changes during development
npm run watch# Run linting
npm run lint
# Run tests
npm test# Prepare for publishing
npm run vscode:prepublishCommitBrew is in beta and we welcome contributions! Here's how you can help:
- Use GitHub Issues to report bugs
- Include VS Code version, OS, and steps to reproduce
- Attach relevant error messages or screenshots
- Open an issue with the "enhancement" label
- Describe the feature and its use case
- Discuss implementation approaches
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests if applicable
- Run
npm run lintand fix any issues - Commit your changes (use CommitBrew! 😉)
- Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Initial beta release
- Basic commit message generation using Gemini API
- Support for conventional commit format
- Interactive message editing
- Automatic .env file detection
- One-click commit functionality
- Beta Status: This extension is in beta, expect some rough edges
- API Rate Limits: Heavy usage may hit Gemini API rate limits
- Large Diffs: Very large changes might exceed API token limits
- Network Dependency: Requires internet connection for AI generation
This project is licensed under the MIT License - see the LICENSE file for details.
- API Key Security: Store your API key in
.envfiles, never commit them - Code Privacy: Your code diffs are sent to Google's Gemini API for processing
- No Data Storage: CommitBrew doesn't store or log your code or commit messages
- Local Processing: All file operations happen locally on your machine
- Google Gemini API for powerful AI capabilities
- VS Code Extension API for seamless integration
- Conventional Commits specification for standardized formatting
Happy Brewing! Make your commits as smooth as your favorite brew.