A simple CLI tool that uses LLMs to automatically generate meaningful & conventional commit messages from your staged changes, while also allowing you to edit the message according to your instructions.
Using the Hugging Face Inference API's generous free tier, you can generate commit messages without incurring additional $$$.
pip install gcmt
Be sure to set your Hugging Face access token as an environment variable:
export HF_TOKEN="<your-token>"
You can get an access token here after signing up for a Hugging Face account.
# Generates a commit message for your staged changes
gcmt
# Generates a commit message and commits them automatically, no additional input required
gcmt --auto-commit
# Choose a different model to generate the commit message. List of models [here](https://huggingface.co/docs/api-inference/supported-models)
gcmt --model_name meta-llama/Meta-Llama-3-70B-Instruct
After generating a commit message, you'll be prompted with several options:
c
: Commit the changes with the generated messagecp
: Copy the generated message to clipboarde "<instructions>"
: Edit the commit message according to your instructions (e.g.,e "make it more concise"
)r
: Re-generate a new commit messagea
: Abort the commit process
🎉 Fun Fact: All of the commit messages in this project were generated using gcmt :)