rewrite-history
1
总安装量
1
周安装量
#78515
全站排名
安装命令
npx skills add https://github.com/doodledood/claude-code-plugins --skill rewrite-history
Agent 安装分布
amp
1
cline
1
opencode
1
cursor
1
continue
1
kimi-cli
1
Skill 文档
Rewrite the current branch’s history into clean, narrative-quality commits suitable for code review.
Goal
Transform messy development history into a logical story reviewers can follow commit-by-commit. Original branch is rewritten; backup preserved for rollback.
Arguments
$ARGUMENTS = optional flags (--auto skips interactive approval)
Preconditions
Abort with clear error if:
- On main/master branch
- Uncommitted changes exist
- No commits to rewrite (branch matches main)
Execution
- Create backup branch:
{branch}-backup-{timestamp}â permanent until manually deleted - Analyze the diff between current branch and mainâunderstand the complete change set
- Create temp branch from main for clean reimplementation
- Plan the narrativeâstructure changes into logical, self-contained commits (foundations â features â polish)
- Reimplement by recreating changes commit-by-commit with conventional commit messages; use
--no-verifyfor intermediate commits - Verify byte-identical:
git diff {original-branch}MUST be emptyâabort if any difference - Replace original branch: point original branch to clean history (final commit runs hooks normally)
- Offer to push with
--force-with-lease
Verification Requirement
The byte-identical check is non-negotiable. If git diff {backup-branch} shows ANY difference after reimplementation:
- Abort immediately
- Report exactly what differs
- Leave backup branch intact for recovery
Constraints
- Analyze the complete diff onlyâignore original commit history
- One concern per commitâatomic, independently revertible
- Conventional commit messages:
type(scope): description - Never add “Co-Authored-By” or “Generated with Claude Code”
- Always use
--force-with-leasefor push (never--force)
Interactive Mode
Unless $ARGUMENTS contains --auto:
- Present proposed commit plan before execution
- Allow adjustment or cancellation
Rollback
If anything goes wrong: git reset --hard {branch}-backup-{timestamp}
Output
Report commit count, backup branch name, and the new commit log.