Skip to content

Instantly share code, notes, and snippets.

@ppcdias
Last active February 25, 2021 01:01
Show Gist options
  • Save ppcdias/169f85ea6cdbe89ce7e6467541100caf to your computer and use it in GitHub Desktop.
Save ppcdias/169f85ea6cdbe89ce7e6467541100caf to your computer and use it in GitHub Desktop.
WordPress .gitignore file for Plugins or Themes development
# -----------------------------------------------------------------
# .gitignore file for WordPress Plugin or Themes development @ppcdias
# ver 20210223
#
# By default all files are ignored. You'll need to whitelist
# any mu-plugins, plugins, or themes you want to include in the repo.
# -----------------------------------------------------------------
# ignore everything in the root except the "wp-content" directory.
/*
!wp-content/
# ignore everything in the "wp-content" directory, except:
# mu-plugins, plugins, and themes directories
wp-content/*
!wp-content/mu-plugins/
!wp-content/plugins/
!wp-content/themes/
# ignore all mu-plugins, plugins, and themes
# unless explicitly whitelisted at the end of this file
wp-content/mu-plugins/*
wp-content/plugins/*
wp-content/themes/*
# ignore all files starting with . or ~
# .*
# ~*
# DS_Store files generated by Finder on MacOS
**/.DS_Store
# ignore node dependency directories (used by grunt)
node_modules/
# ignore OS generated files
ehthumbs.db
Thumbs.db
# ignore Editor files
*.sublime-project
*.sublime-workspace
*.komodoproject
# ignore log files and databases
*.log
*.sql
*.sqlite
# ignore compiled files
*.com
*.class
*.dll
*.exe
*.o
*.so
# ignore packaged files
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
# -------------------------
# Whitelisted Files
# -------------------------
# track these files, if they exist
!.gitignore
# !.editorconfig
# !.phpcs.xml.dist
# !README.md
# !CHANGELOG.md
# !composer.json
# track these mu-plugins, plugins, and themes
# add your own entries here
!wp-content/mu-plugins/example-mu-plugin/
!wp-content/themes/example-theme/
!wp-content/plugins/example-plugin/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment