Use the commitm
command to generate commit messages, modify them, and commit!
Inspired by my brother Adam's AI Shell Command Generator (tweet).
- Generates commit messages using the
llm
CLI based on staged changes - Allows modifying messages to be more general, specific, longer, shorter etc
- Commits generated messages (with the prefix 🤖) or custom messages
Install and configure the llm CLI tool. llm
needs an API key (like the OpenAI API key) to make LLM calls.
The model 4o
(GPT-4o
) is recommended. To set this as your default, run:
llm models default 4o
commitm
will use your default llm
model.
brew install marissamarym/commitm/commitm
Or
brew tap marissamarym/commitm
and then
brew install commitm
Clone this repository to your desired location:
git clone https://github.com/marissamarym/commitm.git
To make the script easily accessible from anywhere, add the following alias to your .zshrc file:
echo 'alias commitm="$HOME/path/to/commitm/src/commitm.zsh"' >> ~/.zshrc
Replace $HOME/path/to/commitm
with the actual path to where you cloned or placed commitm
.
Apply the changes to your .zshrc
by running:
source ~/.zshrc
To generate a commit message:
commitm
To generate a commit message and commit it immediately:
commitm -e
To generate a commit message with a custom prefix (default is 🤖):
commitm -p ✨
To generate a commit message without a custom prefix (default is 🤖):
commitm --no-prefix
To generate a commit message and commit immediately without showing output:
commitm -e -q
commitm
limits the prompt to 4096 tokens.
Any contributions you make are greatly appreciated.
Distributed under the MIT License. See LICENSE for more information.