Skip to content

Repository files navigation

gitsloth: AI-Powered Git Commit Messages

A lightweight Rust CLI that generates clean, Conventional Commit messages from your staged Git changes using OpenAI.

Contributors Forks Stars Version

TL;DRKey FeaturesQuickstartLicense


TL;DR

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).


Why gitsloth

  • Writing high-quality commit messages is repetitive
  • Conventional Commits are useful but often tedious
  • This tool automates the process while staying minimal

Key Features

  • 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)

Quickstart

Install prebuilt binary (recommended)

curl -fsSL https://raw.githubusercontent.com/saccofrancesco/gitsloth/main/install.sh | sh

Installer behavior:

  • detects macOS/Linux and CPU architecture automatically
  • downloads the matching release asset from GitHub Releases
  • installs to /usr/local/bin when 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 | sh

Uninstall

curl -fsSL https://raw.githubusercontent.com/saccofrancesco/gitsloth/main/uninstall.sh | sh

Optional override:

# Remove from a custom directory too
GITSLOTH_INSTALL_DIR="$HOME/bin" curl -fsSL https://raw.githubusercontent.com/saccofrancesco/gitsloth/main/uninstall.sh | sh

Build from source

git clone https://github.com/saccofrancesco/gitsloth.git
cd gitsloth
cargo build --release

Binary path:

./target/release/gitsloth

Setup

export OPENAI_API_KEY=your_api_key_here

Usage

# 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

Flags

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

Examples

Single message (default)

$ ./target/release/gitsloth
⣾ Generating commit messages...
Proposed message:
 feat: add clipboard support and structured git context

Confirm? (y/n):

Multiple messages

$ ./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):

Development

cargo fmt
cargo clippy -- -D warnings
cargo test

Emailware

gitsloth is emailware. If you find it useful, I would like to hear from you.


License

This project is licensed under the MIT License.


GitHub @saccofrancesco

About

Lightweight Rust CLI that turns staged Git diffs into clean Conventional Commit messages with OpenAI, then lets you pick, copy, or commit in one step

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

8 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Contributors

Languages