Analyze and rewrite Git commit messages based on the scope: "$ARGUMENTS"
Rewrites Git commit messages based on a specified scope. Use it to fix bad commits (vague, typos, too short) by analyzing changes and generating better messages. Supports dry-run previews, backup branches, and handles pushed commit warnings.
/plugin marketplace add lpasqualis/lpclaude/plugin install lpclaude-config@lpclaude-marketplacegit/Analyze and rewrite Git commit messages based on the scope: "$ARGUMENTS"
/git:rewrite-commit-descriptions --dry-run fix 10 bad - Preview changes for up to 10 bad commits/git:rewrite-commit-descriptions fix 10 bad - Fix up to 10 bad commits/git:rewrite-commit-descriptions all bad commits - Fix all bad commits in last 50/git:rewrite-commit-descriptions --no-backup-branches bad in last 20 - Fix without backupParse the natural language arguments to determine:
Scope patterns to recognize:
fix N bad or find N bad → Find and fix up to N bad commitsall bad commits → Scan last 50, fix all bad ones foundbad in last N → Check last N commits, fix bad oneslast N → Check last N commitsBefore making any changes:
Use the helper script .claude/utils/git-rewrite-commit-descriptions-helpers/detect-bad-commits.sh to identify commits with poor messages.
Bad commit criteria:
Execute: bash .claude/utils/git-rewrite-commit-descriptions-helpers/detect-bad-commits.sh <scan_limit> <num_to_find>
For each bad commit found:
.claude/utils/git-rewrite-commit-descriptions-helpers/analyze-commit.sh to analyze the commitUse .claude/utils/git-rewrite-commit-descriptions-helpers/generate-replacements.sh to create a mapping file for git-filter-repo.
This script:
.tmp/ directory if it doesn't exist.tmp/git_msg_replacements.txt (project-local temp directory)Use .claude/utils/git-rewrite-commit-descriptions-helpers/apply-rewrites.sh to apply the changes.
Pass appropriate flags:
--dry-run if user requested preview--no-backup if user doesn't want backup branchThe script will:
After execution, show:
Helper Scripts Location:
All helper scripts are in .claude/utils/git-rewrite-commit-descriptions-helpers/:
detect-bad-commits.sh - Find commits with poor messagesanalyze-commit.sh - Analyze a commit and generate better messagegenerate-replacements.sh - Create replacement file for git-filter-repoapply-rewrites.sh - Apply the rewrites using best available toolSafety Features:
.tmp/ directory)Tool Preference:
If git-filter-repo is not installed, provide installation instructions:
brew install git-filter-repopip install git-filter-repoapt install git-filter-repo or equivalent