Claude Code Plugins

Community-maintained marketplace

Feedback

clean-git-history

@anandthakker/dotfiles
2
0

Reimplement a branch with a clean, narrative-quality git commit history suitable for reviewer comprehension. Use when asked to: rewrite git history for PR review, make commits more logical/reviewable, prepare messy work for a pull request.

Install Skill

1Download skill
2Enable skills in Claude

Open claude.ai/settings/capabilities and find the "Skills" section

3Upload to Claude

Click "Upload skill" and select the downloaded ZIP file

Note: Please verify skill by going through its instructions before using it.

SKILL.md

name clean-git-history
description Reimplement a branch with a clean, narrative-quality git commit history suitable for reviewer comprehension. Use when asked to: rewrite git history for PR review, make commits more logical/reviewable, prepare messy work for a pull request.

Clean Git History

Reimplement the current branch on a new branch with clean, logical commits that tell a story. The goal is for the commit history to improve a reviewer's (or future code archeologist's) understanding.

New branch name: Use the provided argument, or default to {source_branch}-clean.

Workflow

  1. Validate source branch

    • Confirm no uncommitted changes or merge conflicts
    • Confirm up to date with main
  2. Analyze the diff

    • Study all changes between source branch and main
    • Understand the final intended state
  3. Create clean branch off main

  4. Plan commit storyline

    • Break into self-contained logical steps
    • Each step should reflect a logical stage of development
  5. Reimplement step by step

    • Recreate the changes in the clean branch, committing step by step according to your plan
    • Each commit should introduce a single, coherent idea, conveyed clearly in the commit message. Ideally, each commit should also pass linting, typechecking, tests; but this is definitely less important than making the history clear and understandable, and indeed sometimes it's actively better to forgo this (e.g. a standalone commit adding a failing test before a subsequent one fixing a bug). Use your judgment.
  6. Verify correctness

    • Final state must exactly match original branch
    • git diff {source_branch} {clean_branch} should be empty

Rules

  • Never rewrite the source branch
  • Omit any standard annotations that you might normally add to commit messages (e.g., "Generated with [Claude Code]", etc.), unless they are already present in the source branch commits.