Repository navigation
UI Implemented an AI Generate Commit Message and Commit Discription #5963
Closed
bwharrington
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
UI Commit Message Generation using xAI - Grok
This fork adds support for generating commit messages with xAI's Grok models.
The goal was to maintain the spirit of the TUI with little effort on the user as possible.
https://github.com/bwharrington/lazygit
Right now it only accepts an xAI API key and defaults to Grok 4.6.
In the future I'll add support for other models and a more dynamic model selector.
Get an xAI API Key here - https://console.x.ai/
API Key Storage
When you save the API key in lazygit (Set xAI API key, or the first time you hit Generate), it tries Windows Credential Manager first (encrypted).
If that fails, it falls back to a plaintext file at
%LOCALAPPDATA%\lazygit\xai_api_key.I don't recommend the plaintext fallback. Windows Credential Manager works fine for me.
How it works
Generate Commit Message runs
git diff --stagedand puts that text in the chat request as the user message, next to a short system prompt.The request is a normal JSON body posted to
https://api.x.ai/v1/chat/completions.What Grok sees is the same kind of patch you get from
git diff --staged— added/removed lines and paths. A brand-new staged file can appear in full, because that's how git diffs work.Diffs larger than ~80,000 bytes are truncated, and the prompt notes that.
All reactions