Skip to content

Instantly share code, notes, and snippets.

@kerasai
Created June 4, 2020 14:52
Show Gist options
  • Save kerasai/588b35cf596f5415d1827c1135cfd4ad to your computer and use it in GitHub Desktop.
Save kerasai/588b35cf596f5415d1827c1135cfd4ad to your computer and use it in GitHub Desktop.
Clean Git type files from dependencies, when they've got to be committed (barf)
#!/usr/bin/env bash
DEPENDENCY_LOCATIONS=("./drush/Commands/contrib")
DEPENDENCY_LOCATIONS+=("./vendor")
DEPENDENCY_LOCATIONS+=("./web/libraries")
DEPENDENCY_LOCATIONS+=("./web/modules/contrib")
DEPENDENCY_LOCATIONS+=("./web/profiles/contrib")
DEPENDENCY_LOCATIONS+=("./web/themes/contrib")
for DEPENDENCY_LOCATION in "${DEPENDENCY_LOCATIONS[@]}"
do
if [[ -d $DEPENDENCY_LOCATION ]]
then
echo "Removing git repository files from dependencies in ${DEPENDENCY_LOCATION}."
find ${DEPENDENCY_LOCATION} -name .git | xargs rm -rf
find ${DEPENDENCY_LOCATION} -name .gitignore | xargs rm -rf
else
echo "The file ${DEPENDENCY_LOCATION} does not exist."
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment