Automate git commits with AI-generated messages in Conventional Commits format.
- Python 3.7+
- Git
- Bash (Git Bash on Windows)
- API token: AITUNNEL (default), OpenAI, or Hugging Face
git clone https://github.com/Father1993/CommitPilot.git
cd CommitPilot
bash install.sh
source ~/.bashrc # Git Bash on Windows; use ~/.bash_profile if neededThe installer:
- installs Python dependencies (
requests,python-dotenv,openai) - creates
config.iniif missing - adds shell aliases
- installs the git hook in the current repo (if
.gitexists)
All settings live in the CommitPilot directory (same folder as auto_commit.py).
Copy .env.example to .env and set your token:
AI_TUNNEL=sk-aitunnel-your-token-hereOptional overrides:
AITUNNEL_BASE_URL=https://api.aitunnel.ru/v1/
AITUNNEL_MODEL=gpt-4.1Edit config.ini (see config.ini.example):
[DEFAULT]
api_provider = aitunnel
branch = master
max_diff_size = 7000branch is legacy (kept for existing configs). Push always uses the current git branch, or -b to override.
Tokens can also be set in config.ini, but .env takes priority for AI_TUNNEL.
Run from any git repository:
cd /path/to/your/project
acommit # git add, AI commit, push current branch
acommit-here # git add, AI commit, no push
acommit-dev # commit and push to origin/dev (-b override)
acommit-main # commit and push to origin/main
acommit-master # commit and push to origin/masterShort aliases (same commands):
acum # same as acommit (push current branch)
acm # same as acommit-here (commit only)
acmd # push current branch + print PR/deploy link
acmm # push to main (-b override)
acmmm # push to master (-b override)After a successful push, acmd prints a one-click URL:
- Open PR if
ghfinds one for this head/base →https://github.com/.../pull/N - Otherwise →
https://github.com/.../compare/BASE...HEAD?expand=1(Create PR form)
BASE resolution:
- feature branch →
devif it exists on remote, else default (main/master) dev→ default production branch- already on default branch → no link
python /path/to/CommitPilot/auto_commit.py [options]
-c, --commit-only Commit without push
-b, --branch NAME Override push branch (default: current branch)
-d, --deploy-link Print PR/compare link after push
-m, --message TEXT Use custom message (skip AI)
-p, --provider NAME aitunnel | openai | huggingface
--test Check token and generate a test message
--get-message Print generated message only
--setup Interactive setup
--setup-hooks Install prepare-commit-msg hook in current repo
-v, --version Show versionAuto-generate a message when you run git commit with an empty message:
python /path/to/CommitPilot/auto_commit.py --setup-hooksOr copy manually:
cp /path/to/CommitPilot/prepare-commit-msg /path/to/project/.git/hooks/
chmod +x /path/to/project/.git/hooks/prepare-commit-msg- Read
git statusandgit diff - Send changes to the configured AI provider
- Run
git add .andgit commit -m "..." - Optionally
git push -u origin <current-or--b-branch> - With
--deploy-link, print PR or compare URL
Default provider: AITUNNEL (OpenAI-compatible API).
acommit --test| Problem | Fix |
|---|---|
| Token not configured | Add AI_TUNNEL=... to CommitPilot/.env |
| Aliases not found | Run source ~/.bashrc or open a new terminal |
| No changes to commit | Make sure you are in a repo with uncommitted changes |
| Hook not working | Set COMMITPILOT_PATH to the CommitPilot directory |
- Install Git for Windows (includes Git Bash).
- Install Python 3 and enable Add to PATH.
- Clone CommitPilot and run
bash install.shfrom Git Bash. - Reload shell:
source ~/.bashrc.
Aliases use absolute paths, so they work from any drive or directory.
python -m pip install pytest
python -m pytest tests/ -qCommitPilot/
├── auto_commit.py # CLI entry point
├── ai_common.py # AI providers and shared helpers
├── prepare-commit-msg # Git hook script
├── install.sh # Installer
├── config.ini.example
└── .env.example
MIT