A CLI that writes your git commit messages for you with AI using Groq. Never write a commit message again.
The minimum supported version of Node.js is v18. Check your Node.js version with
node --version.
-
Install lazycommit:
npm install -g lazycommitt
brew install lazycommitUpgrade:
brew upgrade lazycommit-
Retrieve your API key from Groq Console
Note: If you haven't already, you'll have to create an account and get your API key.
-
Set the key so lazycommit can use it:
lazycommit config set GROQ_API_KEY=<your token>
This will create a
.lazycommitfile in your home directory.
Check the installed version with:
lazycommit --version
If it's not the latest version, run:
npm update -g lazycommittYou can call lazycommit directly to generate a commit message for your staged changes:
git add <files...>
lazycommitlazycommit passes down unknown flags to git commit, so you can pass in commit flags.
For example, you can stage all changes in tracked files as you commit:
lazycommit --all # or -a👉 Tip: Use the
lzcalias iflazycommitis too long for you.
Sometimes the recommended commit message isn't the best so you want it to generate a few to pick from. You can generate multiple commit messages at once by passing in the --generate <i> flag, where 'i' is the number of generated messages:
lazycommit --generate <i> # or -g <i>Warning: this uses more tokens, meaning it costs more.
If you'd like to generate Conventional Commits, you can use the --type flag followed by conventional. This will prompt lazycommit to format the commit message according to the Conventional Commits specification:
lazycommit --type conventional # or -t conventionalThis feature can be useful if your project follows the Conventional Commits standard or if you're using tools that rely on this commit format.
You can exclude specific files from AI analysis using the --exclude flag:
lazycommit --exclude package-lock.json --exclude dist/For large commits with many files, lazycommit automatically stays within API limits:
- Automatic detection: Large diffs are detected
- Per-file splitting: Diffs are split by file first
- Safe chunking: Each file diff is chunked conservatively (default: 4000 tokens)
- Combination: Results are combined into one concise message
You can also integrate lazycommit with Git via the prepare-commit-msg hook. This lets you use Git like you normally would, and edit the commit message before committing.
In the Git repository you want to install the hook in:
lazycommit hook installIn the Git repository you want to uninstall the hook from:
lazycommit hook uninstall-
Stage your files and commit:
git add <files...> git commit # Only generates a message when it's not passed in
If you ever want to write your own message instead of generating one, you can simply pass one in:
git commit -m "My message" -
Lazycommit will generate the commit message for you and pass it back to Git. Git will open it with the configured editor for you to review/edit it.
-
Save and close the editor to commit!
To retrieve a configuration option, use the command:
lazycommit config get <key>For example, to retrieve the API key, you can use:
lazycommit config get GROQ_API_KEYYou can also retrieve multiple configuration options at once by separating them with spaces:
lazycommit config get GROQ_API_KEY generateTo set a configuration option, use the command:
lazycommit config set <key>=<value>For example, to set the API key, you can use:
lazycommit config set GROQ_API_KEY=<your-api-key>You can also set multiple configuration options at once by separating them with spaces, like
lazycommit config set GROQ_API_KEY=<your-api-key> generate=3 locale=enRequired
The Groq API key. You can retrieve it from Groq Console.
Default: en
The locale to use for the generated commit messages. Consult the list of codes in: https://wikipedia.org/wiki/List_of_ISO_639-1_codes.
Default: 1
The number of commit messages to generate to pick from.
Note, this will use more tokens as it generates more results.
Set a HTTP/HTTPS proxy to use for requests.
To clear the proxy option, you can use the command (note the empty value after the equals sign):
lazycommit config set proxy=Default: openai/gpt-oss-120b
The timeout for network requests to the Groq API in milliseconds.
Default: 10000 (10 seconds)
lazycommit config set timeout=20000 # 20sThe maximum character length of the generated commit message.
Default: 50
lazycommit config set max-length=100Default: "" (Empty string)
The type of commit message to generate. Set this to "conventional" to generate commit messages that follow the Conventional Commits specification:
lazycommit config set type=conventionalYou can clear this option by setting it to an empty string:
lazycommit config set type=Default: 4000
The maximum number of tokens per chunk when processing large diffs. This helps avoid API limits and keeps requests fast:
lazycommit config set chunk-size 4000Note: Must be between 1000-8000 tokens (Groq API limit).
This CLI tool runs git diff to grab all your latest code changes, sends them to Groq's AI models, then returns the AI generated commit message.
The tool uses Groq's fast inference API to provide quick and accurate commit message suggestions based on your code changes.
For large commits that exceed API token limits, lazycommit automatically:
- Splits by file to avoid oversized requests
- Chunks each file into manageable pieces (default: 4000 tokens)
- Processes chunks and combines results into a single message
- Falls back gracefully to a high-level summary if needed
This ensures you can commit large changes (like new features, refactoring, or initial project setup) without hitting API limits.
If you get a 413 error, your diff is too large for the API. Try these solutions:
-
Exclude build artifacts:
lazycommit --exclude "dist/**" --exclude "node_modules/**" --exclude ".next/**"
-
Reduce chunk size:
lazycommit config set chunk-size 4000 -
Use a different model:
lazycommit config set model "llama-3.1-70b-versatile"
-
Commit in smaller batches:
git add src/ # Stage only source files lazycommit git add docs/ # Then stage documentation lazycommit
- Check your API key:
lazycommit config get GROQ_API_KEY - Verify you have staged changes:
git status - Try reducing chunk size or excluding large files
- Reduce chunk size:
lazycommit config set chunk-size 4000 - Exclude unnecessary files:
lazycommit --exclude "*.log" --exclude "*.tmp"
- Fast: Groq provides ultra-fast inference speeds
- Cost-effective: More affordable than traditional AI APIs
- Open source models: Uses leading open-source language models
- Reliable: High uptime and consistent performance
- Kartik Labhshetwar: @KartikLabhshetwar
If you want to help fix a bug or implement a feature in Issues, checkout the Contribution Guide to learn how to setup and test the project.
This project is licensed under the Apache-2.0 License - see the LICENSE file for details.
