Skip to content

Instantly share code, notes, and snippets.

@petergi
Created December 14, 2025 05:53
Show Gist options
  • Select an option

  • Save petergi/984948b33c8535472de7fae9d903cb15 to your computer and use it in GitHub Desktop.

Select an option

Save petergi/984948b33c8535472de7fae9d903cb15 to your computer and use it in GitHub Desktop.
Find and remove text from your branches. Just update the files you're targeting. e.g. md, txt, py, go, cs, etc... And of course the text your want to find and clean.
#!/bin/bash
# clean-branch-references.sh
# Branches to clean
BRANCHES=("master" "original" "go-version")
for branch in "${BRANCHES[@]}"; do
echo "Cleaning branch: $branch"
git checkout $branch
# Remove AI references from documentation files
find . -type f \( -name "*.md" -o -name "*.txt" -o -name "*.go" \) \
-not -path "./.git/*" \
-not -path "./build/*" \
-exec sed -i '' \
-e '/🤖 Generated with \[Claude Code\]/d' \
-e '/Co-Authored-By: Claude Sonnet/d' \
-e 's/\[Claude Code\](https:\/\/claude\.com\/claude-code)//g' \
{} \;
# Check for changes
if git diff --quiet; then
echo "No changes in $branch"
else
echo "Changes found in $branch"
git diff --stat
git add -A
git commit -m "chore: remove AI-generated references"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment