$gh <✨/sparkle>
A GitHub CLI extension that brings VS Code's "Generate Commit Message" flow to your terminal. It reads staged changes, asks GitHub Models for a Conventional Commit message, and commits it automatically.
Why sparkle
The name comes from the ✨/sparkle icon in VS Code's "Generate Commit Message"
action. I wanted the same flow inside gh: stage, generate, commit.
Features
- Copilot-style commit message generation from staged diffs
- Handles large changes with summary + trimming
- Defaults to
autowith safe input trimming for large changes - Supports
--language,--examples, and--model - Commits staged changes automatically
Installation
Usage
Stage your changes and run:
Options
-l, --language <LANGUAGE>: Output language for the commit message. Default:english.-e, --examples[=<N>]: Include recent commit messages as examples. If provided without a value, it uses3. Valid range:1..=20.-m, --model <MODEL>: GitHub Models model to use. Default:auto(resolved viamodelPolicy.autoModelsin the prompt config, tried in order until a request succeeds).
# Generate commit message in a different language
# Add previous commit messages as examples (default 3 when flag is present)
# Or specify the number of examples (max 20)
# Use a different GitHub Models model
Prerequisites
- GitHub CLI installed and authenticated (
gh auth login) - A git repository with staged changes
If you use GitHub Enterprise, make sure your host is authenticated:
Notes
- The extension commits automatically using the generated message.
- If there are no staged changes, it exits without committing.
- Large diffs are truncated to fit model input limits.
Upgrade
Large changes handling
For big diffs, it summarizes and trims input, then retries with a smaller budget when
needed. Input budgets and model policy are defined in
assets/commitmsg.prompt.yml.