rewrite-commits

Generate clearer Conventional Commit messages for existing commits.

Usagegit-wrangler rewrite-commits [options]

Warning: This sends redacted commit changes to your configured AI service and then rewrites Git history. Git Wrangler asks before sending data and again before applying generated messages.

Quick start

git-wrangler rewrite-commits

What it does

rewrite-commits selects existing local branch commits, sends redacted change summaries to the configured AI service, previews the generated Conventional Commit messages, and asks before rewriting history.

Merge commits, Git-generated reverts, and fixup/squash/amend commits are skipped. Date filters limit both the commits sent to the AI service and the commits rewritten.

Existing final message trailers are preserved by default, including coauthors, sign-offs, reviews, their order, and multi-line values. Use --remove-coauthors when selected rewritten commits should lose only their coauthor entries.

Before you run it

Configure an AI provider, model, and API key with init or config. Git and git-filter-repo are required.

Git Wrangler sends repository names, short commit IDs, file names, change counts, and redacted diff excerpts. It does not send old commit messages or API keys. Sensitive files, common secret values, generated files, dependencies, caches, and build output are hidden.

Common options

Option Default What it does
--repo <path> Whole workspace Rewrite exactly one repository.
--rewrite-after YYYY-MM-DD Include commits on or after this current author date.
--rewrite-before YYYY-MM-DD Include commits before this current author date.
--skip-conventional Off Leave existing Conventional Commits unchanged.
--require-scope Off Also rewrite conventional messages without a scope.
--body Off Generate a message body as well as a subject.
--remove-coauthors Off Remove coauthors only from commits receiving generated messages.
--no-fetch Off Skip refreshing origin; remote information may be old.
--yes, -y Off Skip both the data-send and rewrite confirmations.
--guided Off Choose options through prompts.

--require-scope includes --skip-conventional behavior and requires generated messages to include a scope.

Advanced AI options

Option Default What it does
--batch-size <number> 10 Set the maximum commits in one AI request, from 1 to 50.
--rpm <number> 300 Limit how quickly AI requests start.
--concurrency <number> 8 Limit simultaneous AI requests, from 1 to 64.
--timeout <seconds> 90 Set the timeout for each AI request.

More examples

# Generate subjects and explanatory bodies
git-wrangler rewrite-commits --body

# Rewrite commits currently dated in 2025
git-wrangler rewrite-commits \
  --rewrite-after 2025-01-01 \
  --rewrite-before 2026-01-01

# Remove coauthors only from commits receiving new messages
git-wrangler rewrite-commits --remove-coauthors