Remove Co-Authored-By
Strip Co-Authored-By trailers from git commit messages using git-filter-repo.
Tool
Location: ~/.local/bin/remove-claude-commits
Dependencies: bun, git-filter-repo
Usage
remove-claude-commits --dry-run # preview affected commits
remove-claude-commits # rewrite history
Flags
--dry-run/-n— list affected commits without modifying anything
Preconditions
- Must be inside a git repository
- Working tree must be clean (no staged or unstaged changes)
Behavior
- Scans all branches for commits containing
Co-Authored-By - In dry-run mode, lists affected commits and exits
- In normal mode, uses
git-filter-repo --message-callbackto strip the lines - Reports how many lines were removed
Side Effects
git-filter-reporemoves theoriginremote after rewriting (safety measure)- All commit hashes from the first affected commit onward will change
- Rewriting invalidates existing commit signatures
- Requires
git remote add, re-signing, andgit push --forceafter running
Workflow
- Ensure working tree is clean
- Run
remove-claude-commits --dry-runto preview - Note existing tags and their commit messages:
git tag -l | xargs -I{} git log --format="{} %s" -1 {} - Push current state to a backup remote if needed
- Run
remove-claude-commits - Re-sign all commits:
git rebase --root --exec 'git commit --amend --no-edit -S' - Re-tag: for each tag, find the new commit by message and
git tag -f -s <tag> <new-hash> - Re-add remote:
git remote add origin <url> - Fetch remote:
git fetch origin - Diff local against remote:
git diff origin/main..HEAD --statto verify only commit messages changed (no file diffs) - If branch is protected, temporarily remove protection:
codeberg-settings unprotect <branch> - Propose force push to the user:
git push --force - Force push tags:
git push --force --tags - Re-apply branch protection:
codeberg-settings apply