Command line tools to use AI coding agents and LLms to generate git commits.
Two different approaches are implemented:
- Using Claude Code in headless model
- Using LLMs to generate commit messages
You need to install Claude Code and log in to your Claude account.
After you clone the repo, you can move the gccl.sh file to a directory in your PATH, e.g. /usr/local/bin.
You can also create a symlink to the file:
ln -s /path/to/gccl.sh /usr/local/bin/gccl
Then, under a git repo, after you stage your changes, you can run gccl to generate commit messages.
For lazygit users, you can add the following to your config file:
- key: <c-c>
description: Generate commit message using Claude Code
command: gccl
context: global
loadingText: "Generating commit message..."
output: popupInspired by https://gist.github.com/karpathy/1dd0294ef9567971c1e4348a90d69285 and jesseduffield/lazygit#3212 (comment).
- OpenAI API key
- llm: a command line tool to interface with LLMs
- fzf: a command line tool to fuzzy search through text, for interactive selection of commits
After you clone the repo, you can move (or create a symlink to) the gclm.sh file to a directory in your PATH, e.g. /usr/local/bin.
You can also create a symlink to the file:
ln -s /path/to/gclm.sh /usr/local/bin/gclm
Then, under a git repo, after you stage your changes, you can run gclm to generate commit messages.
For lazygit users, you can add the following to your config file:
customCommands:
- key: <c-a>
description: Pick AI commit
command: gclm
context: global
output: terminalThis allows you to generate commit messages with Ctrl-a after you stage your changes.
The gclm.sh script is a shell script that uses llm to generate commit messages.
It provides the git diff as context to the LLM, and instructions on how to format the output.
Finally, it uses fzf to let you select one of the generated commit messages and apply it.
You can modify the prompt to change the behavior of the LLM.