Skip to main content

AI-powered Git commit message generator using Google Gemini

Project description

Smart Commit

AI-powered Git commit message generator that follows the Conventional Commits specification using Google Gemini API.

Features

  • Generates commit messages using Google Gemini AI
  • Follows Conventional Commits 1.0.0 specification
  • Interactive editing with Vim
  • Regenerate messages on demand
  • Supports all conventional commit types

Installation

From PyPI (once published)

pip install smart-gcm

From Source

git clone https://github.com/aakashvarma/smart-gcm.git
cd smart-gcm
pip install -e .

Prerequisites

  • Python 3.6 or higher
  • Git
  • Vim
  • Google Gemini API key

Setup

  1. Get your Gemini API key from Google AI Studio

  2. Set the environment variable:

# Linux/Mac
export GEMINI_API_KEY="your-api-key-here"

# Windows
set GEMINI_API_KEY=your-api-key-here

For permanent setup, add to your shell profile:

# Bash (~/.bashrc or ~/.bash_profile)
echo 'export GEMINI_API_KEY="your-api-key-here"' >> ~/.bashrc

# Zsh (~/.zshrc)
echo 'export GEMINI_API_KEY="your-api-key-here"' >> ~/.zshrc

Usage

  1. Stage your changes:
git add <files>
  1. Run Smart Commit:
gcm
  1. Follow the interactive prompts:

    • Select commit type (feat, fix, refactor, style, test, docs, build, ops, chore, revert)
    • Enter optional scope (max 20 characters)
    • Review the AI-generated commit message
  2. Choose an action:

    • a - Accept and commit
    • e - Edit in Vim
    • r - Regenerate message
    • c - Cancel

Commit Types

  • feat: New feature
  • fix: Bug fix
  • refactor: Code refactoring (including performance improvements)
  • style: Code style changes (formatting, semicolons, etc.)
  • test: Adding or updating tests
  • docs: Documentation changes
  • build: Build system or dependency changes
  • ops: Operational/infrastructure changes
  • chore: Maintenance tasks
  • revert: Revert previous commit

Examples

# Feature with scope
feat(auth): add OAuth2 login support
- Implement Google OAuth2 integration
- Add user session management

# Bug fix
fix(api): resolve null pointer exception in user endpoint
- Add null check for user object
- Update error handling

# Breaking change
feat(api)!: change response format to JSON:API spec
BREAKING CHANGE: all API responses now follow JSON:API specification

Development

Project Structure

smart-gcm/
├── smart_commit/
│   ├── __init__.py
│   ├── cli.py          # Command-line interface
│   ├── commit.py       # Commit message generation
│   └── utils.py        # Utility functions
├── setup.py
├── README.md
├── LICENSE
└── .gitignore

Running from Source

python -m smart_commit.cli

License

MIT License - see LICENSE file for details

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

If you encounter any issues or have questions, please file an issue on GitHub.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smart_gcm-0.1.1.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smart_gcm-0.1.1-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file smart_gcm-0.1.1.tar.gz.

File metadata

  • Download URL: smart_gcm-0.1.1.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for smart_gcm-0.1.1.tar.gz
Algorithm Hash digest
SHA256 da5c86683c19e8e1e4ac88da647ed7d2b6c9ff653da6a61bc58eaf00111c76c1
MD5 24e4ee475c41359be882663b4dff1288
BLAKE2b-256 5d614523521e0c4e563c60560ce6db98fac9b4b422838dae5284cecbb3a1afc6

See more details on using hashes here.

File details

Details for the file smart_gcm-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: smart_gcm-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for smart_gcm-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0fcd125d43e7e3f9e86154f9f40119b399e66794cf9256535670a1b3aeb0d2b4
MD5 2b15f5290b170816deb391b0c9e4bb65
BLAKE2b-256 2b85b14dade084f3325f65fe14402d4b7fb9b7d909eedd6c14024be736bf56f5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page