A CLI tool that generates git commit messages using Gemini AI — works in any editor, plays nicely with Husky.
- Writing commit messages manually is tedious
- VS Code Copilot breaks when Husky pre-commit hooks run
- Switching to VS Code just for a commit message when using Vim/Sublime is annoying
git-commit-msg reads your staged diff, sends it to Gemini 2.5 Flash, and gives you a generated commit message you can confirm or edit — right in the terminal.
Requirements: Node.js >= 18, pnpm, Git
git clone https://github.com/subratamondal1029/git-commit-msg.git
cd git-commit-msg
cp .env.example .envOpen .env and add your Gemini API key:
GEMINI_API_KEY=your_api_key_hereGet a free API key at aistudio.google.com
pnpm i
pnpm build
pnpm link --globalIf
pnpm linkfails, runpnpm setupfirst, restart your terminal, then try again.
git add <files>
git-commit-msggit config --global alias.commit-ai '!git-commit-msg'Then use it like a native git command:
git add <files>
git commit-aiUnlike editor-based tools, git-commit-msg runs in the terminal — completely outside the editor. Husky pre-commit hooks run their checks normally. No conflicts.
MIT — Subrata Mondal
