Skip to main content

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.

Metadata

Release files for git-ai-tools 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for git-ai-tools 0.1.1
File Size Uploaded
git_ai_tools-0.1.1.tar.gz 6.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for git-ai-tools 0.1.1
File Interpreter ABI Platform
git_ai_tools-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 14.1 kB

Release files / git_ai_tools-0.1.1.tar.gz

Download URL git_ai_tools-0.1.1.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e89e881d8870fee2ec120fa1c4fc9e00ab83a96c65ccfeede7248f5a7e18420f
BLAKE2b-256 checksum
How to use checksums
de8c9f6d7d1c4b6949fe1499da83555faffa64d6044b2e9d458d8ad3d66365bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release files / git_ai_tools-0.1.1-py3-none-any.whl

Download URL git_ai_tools-0.1.1-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
02f01a80fd982199381d4ab00cf88596d2849fc5a268f51c405ff961fc53b7a4
BLAKE2b-256 checksum
How to use checksums
2d32b683562a714368db22db35c83c465543d8c62934306743dc35b1b1f72570
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page