git auto commit
Project description
gac (Git Auto Commit)
Features
- AI-Powered Commit Messages: Automatically generates clear, concise, and context-aware commit messages using large language models.
- Deep Contextual Analysis: Understands your code by analyzing staged changes, repository structure, and recent commit history to provide highly relevant suggestions.
- Multi-Provider & Model Support: Flexibly works with various leading AI providers (like Anthropic, Groq, OpenAI) and models, easily configured through an interactive setup or environment variables.
- Seamless Git Workflow: Integrates smoothly into your existing Git routine as a simple drop-in replacement for
git commit. - Extensive Customization: Tailor commit messages to your needs with a rich set of flags, including one-liners (
-o), AI hints (-h), commit scope (-s), and specific model selection (-m). - Streamlined Workflow Commands: Boost your productivity with convenient options to stage all changes (
-a), auto-confirm commits (-y), and push to your remote repository (-p) in a single step. - Reroll Capability: Not satisfied with the generated commit message? Simply type
rorrerollat the confirmation prompt to generate a new message. - Token Usage Tracking: Display token consumption statistics (prompt, completion, and total tokens).
How It Works
gac analyzes your staged changes to generate high-quality commit messages with the help of large language models.
How to Use
git add .
gac
Installation and Configuration
1. Installation
Install system-wide using pipx from the GitHub repository:
# Install pipx if you don't have it
python3 -m pip install --user pipx
python3 -m pipx ensurepath
# Install gac
pipx install git+https://github.com/criteria-dev/gac.git
Verify installation:
gac --version
2. Configuration
The recommended way to configure gac is using the interactive setup:
gac init
This command will guide you through selecting an AI provider, model, and securely entering your API keys. It will create or update a user-level configuration file at $HOME/.gac.env.
Example $HOME/.gac.env output:
GAC_MODEL=anthropic:claude-3-5-haiku-latest
ANTHROPIC_API_KEY=your_anthropic_key_here
Alternatively, you can configure gac using environment variables or by manually creating/editing the configuration file.
Managing Configuration with gac config
You can manage settings in your $HOME/.gac.env file using gac config commands:
- Show config:
gac config show - Set a value:
gac config set GAC_MODEL groq:meta-llama/llama-4-scout-17b-16e-instruct - Get a value:
gac config get GAC_MODEL - Unset a value:
gac config unset GAC_MODEL
3. Verify Setup
Test that gac is working properly with your configuration:
# Make a change to a file
echo "# Test change" >> README.md
git add README.md
gac -o # Generate a one-line commit message
You should see an AI-generated commit message.
4. Upgrade
To upgrade gac to the latest version, run:
pipx upgrade gac
Basic Usage
Once installed and configured, using gac is straightforward:
-
Stage your changes:
git add .
-
Run
gac:gac
This will generate a commit message for review. Confirm with
yto accept the message.
Common Commands
- Generate a commit message:
gac - Auto-accept the commit message:
gac -y - Stage all changes and generate a commit message:
gac -a - Generate a one-line commit message:
gac -o - Add a hint for the AI:
gac -h "Fixed the authentication bug" - Push the commit (requires accepting the commit message):
gac -p - Advanced usage: Add all, auto-confirm, push a one-liner with a hint:
gac -aypo -h "update for release"
For a full list of CLI flags, advanced options, and example workflows, see USAGE.md.
Best Practices
- gac loads configuration from two locations (in order of precedence):
- User-level
$HOME/.gac.env(applies to all projects for the user) - Project-level
.env(in the project root, overrides user config if present) Environment variables always take final precedence over both files.
- User-level
- Keep API keys out of version control
- For troubleshooting, see docs/TROUBLESHOOTING.md
Contributing
We welcome contributions! Please see docs/CONTRIBUTING.md for guidelines.
License
This project is licensed under the MIT License. See LICENSE for details.
Community & Support
For questions, suggestions, or support, please open an issue or discussion on GitHub.
Brought to you by Criteria
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gac_dev-0.14.9.tar.gz.
File metadata
- Download URL: gac_dev-0.14.9.tar.gz
- Upload date:
- Size: 28.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ca356136c4dc40ad3d91de20f4c36e736536f30b1c839f8d3dad28dca5cc7c4
|
|
| MD5 |
d110373b6415dbd54147de02734280f7
|
|
| BLAKE2b-256 |
8ed2c395f02e80c6644153256b5af9ee5061b9b6f04262e254e86cac1eefa8c0
|
File details
Details for the file gac_dev-0.14.9-py3-none-any.whl.
File metadata
- Download URL: gac_dev-0.14.9-py3-none-any.whl
- Upload date:
- Size: 32.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f913d5882c4b9a5b5ad96a65c7c6015541f67a703d663ea3079ad368d6756d4f
|
|
| MD5 |
71830b81da3439899c6ebf59525a7220
|
|
| BLAKE2b-256 |
e4d027578270bb956e5cff0723d5c2e09b88abab0d813dbff89e385acd2ba3c2
|