Gen Commit uses LLMs to automatically generate git commit messages. I'm lazy and don't like to write commit messages. Inspired by scommit.
gencommit works exactly like git commit, but it generates the commit message and description for you.
gencommit
is the same as
git commit -m "..." -m "..."
but with a generated commit message.
You can also pass in the same arguments as git commit.
gencommit -a
is the same as
git commit -a -m "..." -m "..."
I recommend aliasing it, personally I alias it to gc
. You can do this by adding the following to your shell configuration file (.zshrc
, .bashrc
, etc.)
alias gc="gencommit"
brew tap raghavpillai/gen-commit
brew install gen-commit
- Python 3.11+
Install the gen-commit package using pip:
pip install gen-commit
If you get
error: externally-managed-environment
This means Python now doesn't want you to install this as a system-wide package. You can install it using pipx
or venv
, or be lazy and install it via:
pip3 install gen-commit --break-system-packages
Once you have it installed, initialize gencommit
gencommit --init
Go to ~/.gen-commit
and add your OpenAI or Anthropic API key.
MODEL=<provider:model (i.e. openai:gpt-4o or anthropic:claude-3-haiku-20240307)>
OPENAI_API_KEY=<your openai api key>
ANTHROPIC_API_KEY=<your anthropic api key>
OPTIONAL:
MAX_LINE_LENGTH=<number>
MAX_TOKENS_ALLOWED=<number>
At the moment only OpenAI and Anthropic are supported.