str=$(cat <<'EOF'
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
EOF
)
git filter-branch --tree-filter "find . -name '*.php' -exec sed -i '' -e 's/$str/REMOVED/g' {} ;"\
Также линк для более подробной инфы: https://help.github.com/articles/remove-sensitive-data/