Skip to main content

A collection of AI-powered Git tools

Project description

Git AI Tools

A collection of AI-powered tools for Git, making your Git workflow eas.

Currently includes:

  • Commit message generation
  • Commit message suggestions
  • Support for multiple AI providers:
    • OpenAI
    • Google Gemini
    • DeepSeek
    • Claude

Installation

Install directly from PyPI:

pip install git-ai-tools

https://github.com/user-attachments/assets/2c07b2d2-415c-4f19-9ad7-7859727b7170

Or install from source:

git clone https://github.com/Mik1337/git-ai-tools.git
cd git-ai-tools
pip install -e .

Configuration

1. Choose your AI provider

You can choose between OpenAI (default), Gemini, or DeepSeek:

git config --global git-ai.ai-model openai  # or 'gemini' or 'deepseek'

2. Configure API Key

Set the API key for your chosen provider:

For OpenAI:

git config --global git-ai.openai-key "your-openai-api-key"
# or export OPENAI_API_KEY="your-openai-api-key"

For Gemini:

git config --global git-ai.gemini-key "your-gemini-api-key"
# or export GEMINI_API_KEY="your-gemini-api-key"

For DeepSeek:

git config --global git-ai.deepseek-key "your-deepseek-api-key"
# or export DEEPSEEK_API_KEY="your-deepseek-api-key"

Available Commands

Commit Messages

  1. Quick commit with AI-generated message:
git add .              # Stage your changes
git ai commit          # Creates a commit with AI-generated message

# Customize the message
git ai commit --shorter          # Get a shorter message
git ai commit --longer           # Get a more detailed message
git ai commit "context here"     # Add custom context

https://github.com/user-attachments/assets/57ef8602-949b-46b4-ac03-6ea97b9583c7

  1. Get commit message suggestions:
# Basic usage - suggests message for staged changes
git ai suggest

# Use unstaged changes instead
git ai suggest --unstaged

# Get suggestion for last commit (useful for amending)
git ai suggest --last

# Customize the message
git ai suggest --shorter          # Get a shorter message
git ai suggest --longer           # Get a more detailed message
git ai suggest "context here"     # Add custom context

Understanding the --last flag

The --last flag is used to generate a commit message based on your last commit's changes instead of the current changes in your working directory. This is particularly useful when:

  • You want to improve/rewrite the message of your last commit
  • You made a quick commit with a poor message and want a better suggestion
  • You plan to amend your last commit and want a better message

Without --last (default behavior):

  • The tool looks at your current changes (either staged or unstaged)
  • Generates a commit message based on what you've modified

With --last:

  • The tool looks at your most recent commit (HEAD)
  • Shows what changes were made in that commit
  • Generates a new commit message for those changes

Example workflow for improving your last commit:

# Get a suggestion for your last commit's changes
git ai suggest --last

# If you like the suggestion, amend your commit with the new message
git commit --amend -m "new message"

Common Workflows

  1. Normal commit workflow:
git add .
git ai commit
  1. Review and edit suggestion before committing:
git add .
git ai suggest > msg.txt
$EDITOR msg.txt
git commit -F msg.txt
rm msg.txt
  1. Amend last commit with better message:
git ai suggest --last
git commit --amend
  1. Direct pipe to commit:
git ai suggest | git commit -F -

Features

  • AI-powered commit message generation
  • Multiple AI provider support
  • Git plugin integration
  • Support for staged/unstaged changes
  • Support for amending commits
  • Customizable message style (shorter/longer)
  • Context-aware suggestions
  • More AI-powered Git tools coming soon

Requirements

  • Python 3.8 or higher
  • Git
  • API key for your chosen AI provider

Contributing

  1. Fork the repository
  2. Make your changes
  3. Create a pull request

License

This project is licensed under the MIT License. See the LICENSE file for details.

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

git_ai_tools-0.1.1.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

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

git_ai_tools-0.1.1-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: git_ai_tools-0.1.1.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for git_ai_tools-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e89e881d8870fee2ec120fa1c4fc9e00ab83a96c65ccfeede7248f5a7e18420f
MD5 cf97eef5a7c9e6d690c60639c025ff94
BLAKE2b-256 de8c9f6d7d1c4b6949fe1499da83555faffa64d6044b2e9d458d8ad3d66365bd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: git_ai_tools-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for git_ai_tools-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 02f01a80fd982199381d4ab00cf88596d2849fc5a268f51c405ff961fc53b7a4
MD5 926b624193675ddd6720324d212d92b4
BLAKE2b-256 2d32b683562a714368db22db35c83c465543d8c62934306743dc35b1b1f72570

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