AI Commit Generator - Generate git commit messages using AI
npm install aicogA CLI tool that automatically generates meaningful git commit messages using AI, based on your staged changes.
- Node.js >= 20
Get your API key from Google AI Studio.
``bash`
aic config -k
This will prompt you to enter your API key, which will be saved locally at ~/.aicog/config.json.
`bash`
export AIC_API_KEY="your-api-key-here"
The app will use the stored config if available, otherwise it falls back to the environment variable.
Stage your changes and run:
`bash`
aic
- Review the generated message in the terminal
- Choose an action:
- [Enter] — Commit with the generated message
- [e] — Edit the message before committing
- [r] — Regenerate (use next available message or generate new ones)
- [i] — Regenerate with additional prompt (provide extra context to AI)
- [s] — Select from available generated messages
- [p] — Commit and push to remote
- [n] — Cancel
#### Auto-Stage with -a Flag
Automatically stage changes before committing:
`bash`
aic -a # Stages all changes (git add .)
aic -a . # Same as above
aic -a src/ # Stage specific path (git add src/)
aic -a ".ts" # Stage by pattern (git add ".ts")
#### Auto-Commit with -y Flag
Skip the confirmation prompt and commit automatically:
`bash`
aic -y # Generate message and commit immediately
aic -a -y # Stage all, generate message, and commit
#### Auto-Push with -p Flag
Generate message, commit, and push to remote in one command:
`bash`
aic -p # Generate, commit, and push to origin
aic -p upstream # Generate, commit, and push to upstream
aic -a -p # Stage all, commit, and push to origin
aic -a -p github # Stage all, commit, and push to github
#### Number of Messages with -n Flag
Specify how many commit message variations to generate:
`bash`
aic -n 10 # Generate 10 commit messages
aic -n 3 -a -y # Generate 3 messages, stage all, and auto-commit
aic -n 5 -p # Generate 5 messages, commit, and push to origin
Default is 5 messages if not specified.
Push the current branch to a remote:
`bash`
aic push # Push to origin
aic push upstream # Push to upstream
aic p # Short alias for origin
aic p github # Short alias for specified remote
Edit app configurations: api key, ai model, commit prompt
`bash`
aic config
#### Options
- -k — Configure API key only-c
- — Configure commit prompt only (choose between global or local config, edit in Vim)-m
- — Configure model only (choose between global or local config)-o
- — Configure AI provider only (quick setup, saved globally)-b
- — Configure number of messages only (choose between global or local config)
#### AI Provider
You can select which AI provider the CLI should use. By default the provider is set to google.
Supported providers:
- google — Gemini AI (default)openai
- — OpenAIanthropic
- — Anthropicdeepseek
- — DeepSeekxai
- — xAI
Option 1: Global Installation
`bash
npm install -g aicog
aicog
Option 2: Using npx
`bash
npx aicog
``