Automate git commits with AI-generated messages in Conventional Commits format.
After installation (one time), use in any project:
cd /path/to/your/project acommit # Automatically: git add + commit + push acommit-here # Commit only, no push
No need to copy files to each project β commands work globally!
git clone https://github.com/Father1993/CommitPilot.git cd CommitPilot bash install.sh source ~/.bashrc # or ~/.zshrc
After installation, acommit commands will work from any directory with a git repository.
Create a .env file in your project root:
AI_TUNNEL=sk-aitunnel-your-token-here # Optional: custom API endpoint and model AITUNNEL_BASE_URL=https://api.aitunnel.ru/v1/ AITUNNEL_MODEL=gpt-4.1
Or use config.ini (example in config.ini.example):
[DEFAULT] api_provider = aitunnel aitunnel_token = sk-aitunnel-your-token-here aitunnel_base_url = https://api.aitunnel.ru/v1/ aitunnel_model = gpt-4.1 branch = master max_diff_size = 7000
Note: config.ini is stored in the CommitPilot directory and used for all projects. Tokens are better stored in .env files in each project.
Main commands:
acommit # Commit with AI message and push to default branch acommit-here # Commit only, no push acommit-dev # Commit and push to dev branch acommit-main # Commit and push to main branch acommit-master # Commit and push to master branch
Additional options:
acommit -b branch # Commit to specified branch acommit -m "msg" # Custom message (disables AI) acommit -p openai # Choose provider (aitunnel/openai/huggingface) acommit --test # Check settings acommit --get-message # Generate message only
- π Automation:
git add,git commit,git pushin one command - π§ AI Providers: AITUNNEL (default), OpenAI, Hugging Face
- π Git Hooks: Automatic generation on
git commit - π‘ Conventional Commits: Messages in standard format
- π Security:
.envsupport for tokens
- Python 3.7+
- Git
- Dependencies:
requests,python-dotenv,openai - API Token: AITUNNEL (recommended), OpenAI or Hugging Face
- Analyze changes: Get
git diffandgit status - Generate message: Send to AITUNNEL API (OpenAI compatible)
- Create commit:
git add .andgit commitwith AI message - Push:
git pushto specified branch (optional)
Message format: Conventional Commits (type(scope): description)
Install once:
cd CommitPilot bash install.sh source ~/.bashrc # or ~/.zshrc
Use in any project:
cd /path/to/your/project acommit # Commit + push acommit-here # Commit only acommit-dev # Commit to dev
In project directory:
# Copy CommitPilot to project or use directly python /path/to/CommitPilot/auto_commit.py python /path/to/CommitPilot/auto_commit.py -c # Commit only python /path/to/CommitPilot/auto_commit.py -b dev # To dev branch
Or create a local alias in project:
# In project root create .bashrc or add to ~/.bashrc alias acommit-local='python "$(pwd)/../CommitPilot/auto_commit.py"'
Local commit:
acommit-here # Commit without pushWorking with branches:
acommit-dev # Commit to dev acommit -b feature/new-feature # To any branch
Git hooks (auto-generation on git commit):
cp prepare-commit-msg /path/to/project/.git/hooks/ chmod +x /path/to/project/.git/hooks/prepare-commit-msg
Message examples:
feat(auth): add OAuth authenticationfix(api): resolve timeout issuedocs: update installation guiderefactor(core): optimize diff processing
Check settings:
acommit --test
Error "API token not configured":
- Check
.envfile withAI_TUNNEL=sk-aitunnel-... - Or configure
aitunnel_tokeninconfig.ini
Aliases not working:
source ~/.bashrc # or ~/.zshrc
- Files
.envandconfig.iniin.gitignore - Don't publish tokens in public repositories
- Use
.envfor local development
MIT Β© Andrej Spinej
CommitPilot/
βββ auto_commit.py # Main module
βββ aitunnel_support.py # AITUNNEL API
βββ openai_support.py # OpenAI API
βββ prepare-commit-msg # Git hook
βββ install.sh # Installer
| Provider | Model | Token |
|---|---|---|
| AITUNNEL (default) | gpt-4.1 | AI_TUNNEL in .env |
| OpenAI | gpt-4o-mini | openai_token in config.ini |
| Hugging Face | Mixtral-8x7B | huggingface_token in config.ini |