Skip to content

subratamondal1029/git-commit-msg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-commit-msg

A CLI tool that generates git commit messages using Gemini AI — works in any editor, plays nicely with Husky.


The Problem

  • 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

The Solution

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.


Demo

Demo GIF


Installation

Requirements: Node.js >= 18, pnpm, Git

Build from source

git clone https://github.com/subratamondal1029/git-commit-msg.git
cd git-commit-msg
cp .env.example .env

Open .env and add your Gemini API key:

GEMINI_API_KEY=your_api_key_here

Get a free API key at aistudio.google.com

pnpm i
pnpm build
pnpm link --global

If pnpm link fails, run pnpm setup first, restart your terminal, then try again.


Usage

Option 1 — Run directly

git add <files>
git-commit-msg

Option 2 — Set as a git alias

git config --global alias.commit-ai '!git-commit-msg'

Then use it like a native git command:

git add <files>
git commit-ai

Why it works with Husky

Unlike editor-based tools, git-commit-msg runs in the terminal — completely outside the editor. Husky pre-commit hooks run their checks normally. No conflicts.


License

MIT — Subrata Mondal

About

git commit message generator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors