Reset and reorganize commits following Conventional Commits
Resets and reorganizes git commits to follow Conventional Commits specification. Use this when you need to clean up messy commit history before merging or sharing code.
/plugin marketplace add pproenca/dot-claude-old/plugin install commit@dot-claudeReorganize git commits following Conventional Commits specification.
Commit message validation runs automatically via hooks.
git rev-parse --git-dir && git branch --show-current && git status --porcelain
If uncommitted changes: STOP - user must commit or stash first.
Create backup:
BACKUP_BRANCH="backup/$(git branch --show-current)-$(date +%Y%m%d-%H%M%S)"
git branch $BACKUP_BRANCH
echo "Backup: $BACKUP_BRANCH"
Use the Task tool with subagent_type="commit:commit-organizer" to analyze the branch.
The agent will:
${CLAUDE_PLUGIN_ROOT}/scripts/analyze-branch.sh to get full diffsPrompt for the agent:
Analyze this branch and propose a commit organization following Conventional Commits specification.
For each proposed commit, provide:
- Files and line count
- Proposed subject (passes "Git Log Test")
- Proposed body (Problem/Solution format)
- Reasoning for this grouping
The agent will return a detailed commit organization plan.
Present the agent's proposed commit organization to the user.
Use AskUserQuestion to confirm the proposed organization:
DO NOT proceed until user approves the plan.
Create TodoWrite list with each commit as an item
Soft reset to branch point:
git reset --soft $BRANCH_POINT
# Stage ONLY the files for this commit
git add [specific files]
git status # Verify only intended files staged
# Create commit with agent's proposed message
git commit -m "$(cat <<'EOF'
[Agent's proposed subject]
[Agent's proposed body]
EOF
)"
git log --oneline $BRANCH_POINT..HEAD
git log --stat $BRANCH_POINT..HEAD
git status
Check that:
If anything goes wrong:
git reset --hard $BACKUP_BRANCH