π AI-powered Git commit message rewriter.
- π Batch Rewording: Reword multiple commits at once
- π€ AI-Powered: Generate professional commit messages using AI
- π Multi-Provider: Support OpenAI, Anthropic, Google, MiniMax, and more
- π¬ Interactive UI: Review and accept/skip/regenerate suggestions
- π― Flexible Targeting: Support
--last,--since, range, and single commit - π€ Agent Friendly: First-class integration for AI agents with
--format jsonl
| Tool | Limitation |
|---|---|
| Most AI commit message tools (e.g., aicommits, opencommit) | Only handles the most recent commit |
| AI coding assistants (Claude Code, etc.) | Inconvenient for processing batches of commits in conversation |
| Manual rebase | Tedious for multiple commits |
npm i -g git-reword
# or
bun add -g git-reword# Reword the last commit (default)
git-reword
# Reword the last N commits
git-reword --last 5
# Reword commits from a specific ref
git-reword --since abc1234
# Reword commits in range
git-reword HEAD~3..HEAD
# Reword a specific commit
git-reword abc1234
# Generate commit message for staged changes
git-reword --stagedInteractive UI displays commits with AI-generated suggestions. For each commit, you can:
- Accept: Use AI-generated message
- Skip: Keep original message
- Regenerate: Request new AI message
- Abort: Cancel entire operation
# Interactive mode (default)
git-reword --last 3
# Skip confirmation - apply all changes automatically
git-reword --yes --last 3Generate a commit message for staged changes:
# Stage your changes first
git add .
# Generate and apply commit message
git-reword --staged
# Output:
# Suggested message:
# feat(api): add user authentication middleware
#
# Apply? [y/n]
# y: git commit with suggested message
# n: cancel, no commit| Option | Description |
|---|---|
--last <n> |
Reword the last N commits |
--since <ref> |
Reword commits from ref's next commit to HEAD |
--dry-run |
Preview without executing rebase |
--yes, -y |
Skip confirmation, apply all changes |
--skip-check, -k |
Skip uncommitted changes check (debugging) |
--staged |
Generate commit message for staged changes |
--format <fmt> |
Output format: text (default) or jsonl (AI agent) |
--apply, -a |
Apply pre-confirmed rewrites from stdin (skip AI generation) |
Preview changes without executing the rebase:
git-reword --dry-run --last 3
# Output:
# Commit abc123:
# OLD: "fix: bug"
# NEW: "fix(auth): resolve login timeout issue"
# ---
# Commit def456:
# OLD: "update"
# NEW: "feat(api): add rate limiting middleware"The tool uses a two-phase approach for safe operation:
- Confirmation Phase: Generate AI messages, display each for your review
- Execution Phase: Once confirmed, execute the rebase once
# Phase 1: Confirmation (no rebase yet)
git-reword --last 3
# β Show commit-1: old β new? [y/n/q]
# β Show commit-2: old β new? [y/n/q]
# β Show commit-3: old β new? [y/n/q]
# All confirmed!
# Phase 2: Execute rebase (all at once)
# β Running: git rebase -i --exec "..."
# β Done. 3/3 commits rewroteWith --yes flag, it skips confirmation and applies AI messages to all commits.
Create ~/.git-rewordrc:
provider=anthropic
model=claude-sonnet-4-20250514
apiKey=your-api-key
| Provider | Default Model |
|---|---|
openai |
gpt-5-mini |
anthropic |
claude-haiku-4-5 |
google |
gemini-2.5-flash |
provider=openai
model=gpt-5-mini
apiKey=sk-...
provider=anthropic
model=claude-haiku-4-5
apiKey=sk-ant-...
provider=google
model=gemini-2.5-flash
apiKey=AIza...
provider=anthropic
model=MiniMax-M2.5
baseUrl=https://api.minimax.io/anthropic/v1
apiKey=sk-...
provider=anthropic
model=MiniMax-M2.5
baseUrl=https://api.minimaxi.com/anthropic/v1
apiKey=sk-...
When rewording GPG-signed commits:
- Signed commits remain signed:
git commit --amendwithout-Spreserves the signature - Unsigned commits remain unsigned: No new signature is added
If you use GPG-signed commits and git-reword prompts for passphrase during rebase:
-
Extend GPG agent cache lifetime:
echo "default-cache-ttl 86400" >> ~/.gnupg/gpg-agent.conf echo "max-cache-ttl 604800" >> ~/.gnupg/gpg-agent.conf gpgconf --reload gpg-agent
-
Refresh cache before running git-reword:
git commit --amend --no-edit -S
Verify signatures after reword:
git log --show-signature -5The CLI outputs structured data for easy parsing by AI agents:
# Text mode (default) - human-readable
git-reword --last 5
# Output:
# β Commit abc123 rewrote
# β Commit def456 rewrote
# Done. 2/2 commits rewrote
# JSONL mode - machine-readable
git-reword --format jsonl --last 5
# Output:
# {"commit":"abc123...","shortCommit":"abc1234","originalMessage":"fix bug","newMessage":"fix: resolve authentication timeout"}
# {"commit":"def456...","shortCommit":"def4567","originalMessage":"add feat","newMessage":"feat(api): add user authentication"}
All reword operations target commits on the current branch only. This tool uses git rebase internally, which replays commits onto the current branch.
# β
Correct: operate on current branch
git checkout feature-a
git-reword --last 3
# β
Correct: checkout target branch first
git checkout feature-b
git-reword --since abc1234Before rewording commits (not --staged):
- No uncommitted changes: Ensures safe rebase operation
- Fast-forward possible: Verifies commits haven't been rebased or amended
Use --skip-check to bypass these checks (for debugging).
Rewording commits only modifies commit messages, not code contentβso conflicts should not occur. If a conflict somehow happens (rare), the tool will:
- Detect the conflict via rebase exit code
- Abort the rebase automatically
- Show clear error with the commit hash
- Provide recovery instructions
# Recovery options:
# Option 1: Cancel the entire operation
git rebase --abort
# Option 2: Resolve manually, then continue
# 1. git status # see conflicted files
# 2. git diff # understand the conflict
# 3. Edit files to resolve
# 4. git add <resolved-files>
# 5. git rebase --continue- Empty Response: If AI returns empty or invalid message, falls back to original message
- Rate Limiting: Automatic retry with exponential backoff (3 retries max: 1s, 2s, 4s)
The tool only operates in the current Git repository. It does not support:
- Multi-repo operations
- Cross-path operations
- Project config vs user config distinction
| Code | Meaning |
|---|---|
0 |
Success: all commits rewrote |
1 |
Error: invalid arguments, config error, git error |
2 |
User interrupt: aborted with q or Ctrl+C |
3 |
Partial: some commits rewrote, some skipped |
Apache-2.0 Β© yelo, 2026 - present
