Skip to main content

Git commit message generator

Project description

A git commit message generator.

git add . && git commit -am "ugh... what did I do? what do I even say here?"

gitme -c

gitme-cli-generate

gitme show

gitme-cli-show

Features

  • Analyzes git diffs to generate contextually relevant commit messages
  • Operates only on local git repositories, NO remote interaction
  • Detects untracked files and prompts to add them
  • Supports staged changes only or all modified files
  • Direct commit with user confirmation
  • Multiple AI Providers: Choose between Anthropic or OpenAI, default is Anthropic
  • Selectable model options for both providers
  • Saves message history for search and review
  • Repository-specific message storage

Installation

Install from PyPI:

pip install gitme-cli

Or install directly from GitHub:

pip install git+https://github.com/wangjing0/gitme.git

Or develop locally:

git clone https://github.com/wangjing0/gitme.git
cd gitme
pip install -e .

AI Provider Setup

Choose one or both providers:

For Anthropic Claude (default):

export ANTHROPIC_API_KEY="your-anthropic-api-key-here"

For OpenAI GPT (Optional):

export OPENAI_API_KEY="your-openai-api-key-here"

Note: All gitme commands must be run from within a git repository directory. If you're not in a git repository, you'll see an error message prompting you to run git init.

Basic Usage

# Generate message for staged changes (default - uses Anthropic Claude)
gitme

# Generate message for all changes
gitme -a

# Generate message and commit
gitme -c
# Use OpenAI instead of Anthropic (default)
gitme -p openai

# Use OpenAI with specific model
gitme -p openai -m gpt-4o

# Use Anthropic with specific model
gitme -m claude-3-5-haiku-latest

# Combine with other options
gitme -p openai -c  # Use OpenAI and commit

Untracked Files Handling

When you run gitme, it will automatically detect any untracked files in your repository and prompt you to add them to the staging area:

📁 Untracked files found:
    new_feature.py
    test_file.js
 Do you want to add these untracked files to the staging area? [y/N]:
  • Choose y to add all untracked files to staging and include them in the commit message generation
  • Choose N to proceed without the untracked files (they won't be included in the analysis)

Message History

# Show previous messages (includes provider/model info)
gitme show

# Show last 5 messages
gitme show -n 5

# Show from all repositories
gitme show -r

# Clear history
gitme show --clear

Enhanced Message History Display:

[1] 2025-07-20 10:30:45
    💬 Message:
    Add user authentication feature
    
    - Modified auth.py
    - Updated config.json
    - Added login.html
    🤖 AI Provider: Anthropic (claude-3-5-haiku-latest)
    📝 Files changed: 3

[2] 2025-07-20 09:15:22
    💬 Message:
    Fix authentication bug
    
    - Fixed login validation
    🤖 AI Provider: Openai (gpt-4o-mini)
    📝 Files changed: 1

Options

Generate Options

  • -s, --staged: Analyze only staged changes
  • -a, --all: Analyze all changes (staged and unstaged)
  • -p, --provider: Choose AI provider (anthropic or openai, default: anthropic)
  • -m, --model: Model to use (provider-specific)
  • -c, --commit: Create commit with generated message (uses git commit -a -m "auto-generated message")

Show Options

  • -n, --limit: Number of messages to show
  • -r, --all-repos: Show messages from all repositories
  • --clear: Clear message history

Available Models

Anthropic Claude:

  • claude-3-5-haiku-latest (default)
  • claude-3-haiku-20240307
  • claude-3-sonnet-20240229

OpenAI GPT:

  • gpt-4o-mini (default when using OpenAI)
  • gpt-4o
  • gpt-4

Privacy & Security Notice

⚠️ Important: When using gitme or gitme generate, your code changes will be sent to the selected AI provider (Anthropic Claude or OpenAI GPT) for processing. The tool does NOT send your entire codebase - only the diff contents of changed files.

Please exercise caution when using this tool:

  • Avoid using it with repositories containing sensitive information, credentials, or proprietary code
  • Review your changes before running the command to ensure no sensitive data is included
  • Consider using .gitignore to exclude sensitive files from git tracking
  • Be aware that different providers have different data handling policies
  • Both Anthropic and OpenAI have their own privacy policies and data retention practices

Requirements

  • Python 3.8+
  • Git
  • At least one AI provider API key:
    • Anthropic API key for Claude models
    • OpenAI API key for GPT models, openai Python package for OpenAI support

New Release

chmod +x release.sh && ./release.sh 0.4.4

Contributing

Contributions are welcome! Please feel free to submit a pull request. ❤️ @wangjing0

License

MIT

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

gitme_cli-0.4.5.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

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

gitme_cli-0.4.5-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file gitme_cli-0.4.5.tar.gz.

File metadata

  • Download URL: gitme_cli-0.4.5.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.13

File hashes

Hashes for gitme_cli-0.4.5.tar.gz
Algorithm Hash digest
SHA256 a3927f2f15a33054ab5eb12cf3945c1c57ed1b6f7e17105b30a63fa2a6cdf593
MD5 7b4febd21fbe428cad8667143a83fe95
BLAKE2b-256 7c9f2ecbddc44ad1cc9430d6df22bfc544e3feb22f4eb45e8367124beb5b73f0

See more details on using hashes here.

File details

Details for the file gitme_cli-0.4.5-py3-none-any.whl.

File metadata

  • Download URL: gitme_cli-0.4.5-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.13

File hashes

Hashes for gitme_cli-0.4.5-py3-none-any.whl
Algorithm Hash digest
SHA256 aa7f6a32f3c01826ebd97a90459b9aefbef3641918c17e64fc1a99e4363fc029
MD5 4e495af62e4f0c7a6ef96a2ed958dc0d
BLAKE2b-256 81ad36f9989a2d9c07269cd5303faeaab184f6ded3ef2cb6cfb4b7daecb27c73

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