Created
September 23, 2021 17:42
-
-
Save eriktdesign/fd19ae1930c8de7f33a770f917ab2002 to your computer and use it in GitHub Desktop.
Generate a .gitignore file based on WP Engine's WordPress .gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$1" != "" ]; then | |
theme_name=$1 | |
fi | |
FILE=.gitignore | |
if test -f "$FILE"; then | |
echo ".gitignore exists, aborting." | |
else | |
curl https://wpengine.com/wp-content/uploads/2013/10/recommended-gitignore-no-wp.txt -o .gitignore | |
echo "Wrote new .gitignore" | |
echo " | |
# Plugins | |
wp-content/plugins/* | |
wp-content/plugins/**/" >> .gitignore | |
echo "Excluded plugins" | |
if [ theme_name != "" ]; then | |
echo " | |
# Themes | |
wp-content/themes/**/ | |
!wp-content/themes/$theme_name/ | |
!wp-content/themes/$theme_name/* | |
!wp-content/themes/$theme_name/**/*" >> .gitignore | |
echo "Included theme: $theme_name" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment