# Clean-Claude.ps1
$ErrorActionPreference = "Stop"
Write-Host "=== Scrubbing Claude contributions from Git history ===" -ForegroundColor Cyan
# 1. Remove commits authored by Claude / Anthropic
# Drops commits where the author name contains 'claude' or author email is 'claude@anthropic.com'
git filter-repo --force --commit-callback '
if commit.author_email == b"claude@anthropic.com" or b"claude" in commit.author_name.lower():
commit.file_changes = []
'
# 2. Strip "Co-authored-by: Claude..." lines from remaining commit messages
git filter-repo --force --message-callback '
import re
cleaned = re.sub(rb"(?i)^Co-authored-by:.*claude.*\n?", b"", message, flags=re.MULTILINE)
return cleaned
'
Write-Host "=== Complete! Verify your history with 'git log' before force pushing ===" -ForegroundColor Green