de-claude
v2.2.1
Published
Remove Claude co-authorship attribution from git commits
Downloads
136
Maintainers
Readme
de-claude
Remove Claude co-authorship attribution from git commits and scan your repo for Claude mentions.
Installation
npm install -g de-claudeUsage
Run in any git repository:
de-claudeThis will:
- Find all unpushed commits with Claude attribution
- Show a preview of commits to be cleaned
- Ask for confirmation
- Remove the attribution lines and rewrite history
Commands
de-claude has three modes:
| Command | Description |
|---------|-------------|
| de-claude (or de-claude clean) | Strip Claude attribution from commit messages (default) |
| de-claude scan-files | Scan tracked files in the repo for Claude mentions |
| de-claude scan | Interactively review and rewrite commit messages |
Options (clean)
--dry-run Show what would happen without making changes
-y, --yes Skip confirmation prompt
--verbose Show actual lines being removed
--last <n> Process only the last N commits (first-parent only)
--all Process all commits on the current branch
--range <range> Explicit git commit range (e.g., HEAD~5..HEAD)
--remote Rewrite already-pushed commits (requires --last, --all, or --range; force-pushes)
--broad Also match commits that mention Claude anywhere in the message
-h, --help Display help
-V, --version Display version--last, --all, and --range are mutually exclusive.
Selecting which commits to process
By default, de-claude auto-detects unpushed commits by comparing against your tracking branch. You can override this:
Last N commits (recommended for most cases):
de-claude --last 3--last follows only the first-parent line, so merge commits count as one commit. --last 5 always processes exactly 5 commits regardless of merge history.
All commits on the branch:
de-claude --allExplicit git range (for advanced usage):
de-claude --range HEAD~10..HEAD
de-claude --range origin/main..HEADNote: --range does not use --first-parent, so ranges that include merge commits may process more commits than expected.
Cleaning already-pushed commits
To rewrite commits that have already been pushed to the remote, add --remote. This will force-push after rewriting:
de-claude --remote --last 10
de-claude --remote --all
de-claude --remote --range abc1234..HEAD--remote requires confirmation before force-pushing. Pass --yes to skip all prompts (useful for scripts and CI).
Scanning files for Claude mentions
Scan all tracked files in your repo for Claude-related content:
de-claude scan-filesBy default, this looks for attribution patterns (Co-Authored-By, "Generated with Claude"). To also find broader mentions of "claude" (variable names, comments, docs), use --broad:
de-claude scan-files --broadResults are grouped by file with line numbers and match types.
Interactive commit review
Review commit messages one by one and choose how to handle each:
de-claude scan --last 10
de-claude scan --all
de-claude scan --range origin/main..HEADFor each commit with Claude attribution, you can:
- Strip — auto-remove Claude lines (same as default
cleanbehavior) - Edit — open your
$EDITORto write a custom replacement message - Skip — leave the commit unchanged
This uses the same remote/local rewriting strategy as clean:
# Review and rewrite locally (you push manually afterward)
de-claude scan --last 10
# Review, rewrite, and force-push in one step
de-claude scan --remote --last 10Options: --last <n>, --all, --range <range>, --remote, --broad, --verbose, --dry-run, -y/--yes.
Use --yes to auto-strip all found attributions without per-commit prompts (useful for scripts):
de-claude scan --yes --remote --allUse --broad to also match commits that mention "Claude" anywhere in the message (not just attribution lines).
Other examples
Preview changes without applying them:
de-claude --dry-runSee exactly which lines will be removed:
de-claude --dry-run --verboseSkip confirmation (useful for scripts):
de-claude --yesWhat it detects
Co-Authored-Bylines containing "Claude" or "@anthropic.com"Generated with [Claude Code]lines- With
--broad: any line mentioning "Claude" (e.g., "CLAUDE.md", "Claude Code agents", variable names)
Before
feat: Add user authentication
Implemented JWT-based auth flow with refresh tokens.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>After
feat: Add user authentication
Implemented JWT-based auth flow with refresh tokens.How it works
The tool uses git filter-branch to rewrite commit messages. It only rewrites commits starting from the oldest affected commit, minimizing unnecessary history changes.
When using interactive mode (scan), custom replacement messages are matched by original message content during the filter-branch pass — this allows per-commit customization while still using a single efficient rewrite operation.
Auto-detection (no flags)
When run without --last, --all, or --range, de-claude automatically determines which commits to scan:
- Tracking branch exists (e.g.,
origin/main): scans only unpushed commits - Feature branch: scans commits since branching from main/master
- No remote: scans all commits on the current branch
History rewriting
Changing a commit message changes its SHA. Every descendant commit also gets a new SHA because its parent changed. This is inherent to git — de-claude minimizes the blast radius by starting the rewrite from the oldest affected commit, not the full scan range.
Submodules
Repositories with git submodules work out of the box. Submodules are automatically ignored — their commit history is independent and managed in their own repos. de-claude only operates on the parent repository's commits.
Requirements
- Node.js 18+
- Git
License
MIT
