A lightweight Rust CLI that generates clean, Conventional Commit messages from your staged Git changes using OpenAI.
TL;DR • Key Features • Quickstart • License
gitsloth reads your staged Git diff (plus branch name and status), asks OpenAI for one or more Conventional Commit messages, lets you select one, then commits it (or copies it to your clipboard).
- Writing high-quality commit messages is repetitive
- Conventional Commits are useful but often tedious
- This tool automates the process while staying minimal
- AI-generated Conventional Commit messages
- Multiple suggestions with interactive selection
- Git context: branch, short status, staged diff
- Optional stage-all flow (
-a) - Optional clipboard flow (
-c) - Optional confirmation bypass for single message (
-y) - Minimal dependency strategy (Rust stdlib + only HTTP/JSON crates)
curl -fsSL https://raw.githubusercontent.com/saccofrancesco/gitsloth/main/install.sh | shInstaller behavior:
- detects macOS/Linux and CPU architecture automatically
- downloads the matching release asset from GitHub Releases
- installs to
/usr/local/binwhen writable, otherwise~/.local/bin - adds the install directory to your shell profile when needed
Optional overrides:
# Install a specific tag
GITSLOTH_VERSION=v1.3.1 curl -fsSL https://raw.githubusercontent.com/saccofrancesco/gitsloth/main/install.sh | sh
# Install to a custom directory
GITSLOTH_INSTALL_DIR="$HOME/bin" curl -fsSL https://raw.githubusercontent.com/saccofrancesco/gitsloth/main/install.sh | shcurl -fsSL https://raw.githubusercontent.com/saccofrancesco/gitsloth/main/uninstall.sh | shOptional override:
# Remove from a custom directory too
GITSLOTH_INSTALL_DIR="$HOME/bin" curl -fsSL https://raw.githubusercontent.com/saccofrancesco/gitsloth/main/uninstall.sh | shgit clone https://github.com/saccofrancesco/gitsloth.git
cd gitsloth
cargo build --releaseBinary path:
./target/release/gitslothexport OPENAI_API_KEY=your_api_key_here# Generate a single commit message (with confirmation)
./target/release/gitsloth
# Generate multiple messages and choose one
./target/release/gitsloth -g 3
# Stage everything before generating
./target/release/gitsloth -a
# Copy selected message to clipboard instead of committing
./target/release/gitsloth -c
# Skip confirmation when generating a single message
./target/release/gitsloth -y
# Print installed version
./target/release/gitsloth -v| Flag | Shorthand | Description |
|---|---|---|
--generate |
-g |
Number of commit messages to generate |
--all |
-a |
Stage all changes before generating |
--clipboard |
-c |
Copy the selected message instead of committing |
--yes |
-y |
Skip confirmation prompt for single message |
--version |
-v |
Print gitsloth version |
$ ./target/release/gitsloth
⣾ Generating commit messages...Proposed message:
feat: add clipboard support and structured git context
Confirm? (y/n):$ ./target/release/gitsloth -g 3
⣾ Generating commit messages...Generated messages:
1) feat: add clipboard support
2) feat: improve commit generation prompt context
3) refactor: simplify commit selection flow
Select (0 to abort):cargo fmt
cargo clippy -- -D warnings
cargo testgitsloth is emailware. If you find it useful, I would like to hear from you.
This project is licensed under the MIT License.
GitHub @saccofrancesco