Skip to content

Instantly share code, notes, and snippets.

@twfahey1
Created January 26, 2021 16:46
Show Gist options
  • Save twfahey1/cf3a0ca4d2a8d03b5de3132ce2c54ab9 to your computer and use it in GitHub Desktop.
Save twfahey1/cf3a0ca4d2a8d03b5de3132ce2c54ab9 to your computer and use it in GitHub Desktop.
Sanitize all git folders in subdirectories
# Temporarily move current .git to not purge it.
mv .git .gitbackup
mv .gitignore .gitignorebackup
# Purge all gits
find . \( -name ".git" -o -name ".gitignore" -o -name ".gitmodules" -o -name ".gitattributes" \) -exec rm -rf -- {} +
# Put back original git
mv .gitbackup .git
mv .gitignorebackup .gitignore
@twfahey1
Copy link
Author

Useful to ensure composer downloaded dependencies don't have submodule git folders, which will cause issues with providers like Pantheon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment