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 pushNo 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 ~/.zshrcAfter 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.1Or 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 = 7000Note: 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 branchAdditional 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 ~/.zshrcUse in any project:
cd /path/to/your/project
acommit # Commit + push
acommit-here # Commit only
acommit-dev # Commit to devIn 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 branchOr 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 branchGit hooks (auto-generation on git commit):
cp prepare-commit-msg /path/to/project/.git/hooks/
chmod +x /path/to/project/.git/hooks/prepare-commit-msgMessage examples:
feat(auth): add OAuth authenticationfix(api): resolve timeout issuedocs: update installation guiderefactor(core): optimize diff processing
Check settings:
acommit --testError "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 |