-
-
Save salcode/9940509 to your computer and use it in GitHub Desktop.
# ----------------------------------------------------------------- | |
# .gitignore for WordPress | |
# Bare Minimum Git | |
# http://ironco.de/bare-minimum-git/ | |
# ver 20150227 | |
# | |
# This file is tailored for a WordPress project | |
# using the default directory structure | |
# | |
# This file specifies intentionally untracked files to ignore | |
# http://git-scm.com/docs/gitignore | |
# | |
# NOTES: | |
# The purpose of gitignore files is to ensure that certain files not | |
# tracked by Git remain untracked. | |
# | |
# To ignore uncommitted changes in a file that is already tracked, | |
# use `git update-index --assume-unchanged`. | |
# | |
# To stop tracking a file that is currently tracked, | |
# use `git rm --cached` | |
# | |
# Change Log: | |
# 20150227 Ignore hello.php plugin. props @damienfa | |
# 20150227 Change theme ignore to wildcard twenty*. props @Z33 | |
# 20140606 Add .editorconfig as a tracked file | |
# 20140404 Ignore database, compiled, and packaged files | |
# 20140404 Header Information Updated | |
# 20140402 Initially Published | |
# | |
# ----------------------------------------------------------------- | |
# ignore everything in the root except the "wp-content" directory. | |
/* | |
!wp-content/ | |
# ignore all files starting with . | |
.* | |
# track this file .gitignore (i.e. do NOT ignore it) | |
!.gitignore | |
# track .editorconfig file (i.e. do NOT ignore it) | |
!.editorconfig | |
# track readme.md in the root (i.e. do NOT ignore it) | |
!readme.md | |
# ignore all files that start with ~ | |
~* | |
# 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 | |
# ignore everything in the "wp-content" directory, except: | |
# "mu-plugins" directory | |
# "plugins" directory | |
# "themes" directory | |
wp-content/* | |
!wp-content/mu-plugins/ | |
!wp-content/plugins/ | |
!wp-content/themes/ | |
# ignore these plugins | |
wp-content/plugins/hello.php | |
# ignore specific themes | |
wp-content/themes/twenty*/ | |
# ignore node/grunt dependency directories | |
node_modules/ |
Thanks!
You should add .idea for phpstorm project files also.
You should add .idea for phpstorm project files also.
A good thought but this folder is already excluded due to
# ignore all files starting with .
.*
As a side note, I'm now using this other WordPress .gitignore file, which excludes everything by default, allowing me to whitelist only those plugins and/or themes I want to include.
maybe you could add:
# sublime sftp sensitive info
sftp-config.json
Thanks for the note. If sftp-config.json
is in the root of the project, it should already be ignored. (Everything in the root of the project is ignored unless it is specifically whitelisted, e.g. !.gitignore
)
If you're not seeing that behavior (or if you have a use-case for sftp-config.json
in a different location), let me know and I'll take a look at it. Unfortunately, Gists don't provide notifications when a comment is left. If you want to leave a comment at https://salferrarello.com/wordpress-gitignore/ instead, I'll get notified in a much more timely manner.
Thanks.
How do you clone a project with this project structure?
Something like
git clone <repo> .
throws fatal: destination path '.' already exists and is not an empty directory.
Hello, I'm now using this gitignore for development. My question is on the plugins management:
It's very useful to have plugins tracked across environments and this gitignore tracks them unless you ignore specific plugins (like hello.php ecc..) which is fine. The problem is when the plugins have been updated. The files will sync because they are tracked in the GIT repo, which is ok. But what if the updated version of the plugin needs a DB update/upgrade, too? If so, you must always deactivate and activate again all the updated and pulled plugins to ensure eventual tables of the plugins are synced, too.
Do you have a solution for this problem or it is better to not track the plugins at all and install them manually on each environment which is a little bit frustrating to me?
Thanks
Thank you
Thanks a lot. It worked fine!
@salcode Thanks for sharing!