For months I've been trying to plan out a good project structure for using git version control for WordPress website development that doesn't sacrifice the ability to update core and plugins through the WP dashboard, doesn't require an unconventional directory structure (wp-content outside of the WP parent folder) and that is easy to manage and deploy whole websites. I've read about submodules, subtrees, nested repos, etc, and I'm still having a hard time fitting it all together and choosing the right strategy.
Here's what I'm thinking right now, with my thoughts for how I would handle git repos in parenthesis.
root (main project repo) |-- wordpress (public git repo added as subtree) | |-- wp-content | | |-- plugins | | | |-- my-custom-plugin (git repo added as subtree) | | | |-- other-plugin-with-git-repo (git repo added as subtree) | | | +-- other-plugin-without-git-repo (ignored/untracked) | | |-- themes | | | |-- my-custom-theme (git repo added as subtree) | | | |-- other-theme-with-git-repo (git repo added as subtree) | | | +-- other-theme-without-git-repo (ignored/untracked) | | +-- uploads (ignored/untracked) | |-- wp-admin | +-- wp-includes |-- wp-config.php (ignored/untracked) +-- other-files.txt
This leaves me with several problems/questions;
Automatic updates; I love the new auto updates feature, it could potentially save a lot of time and effort in keeping my sites updated and secure, but it seems that it throws a wrench in tracking code changes with git. Is there any way to track my code changes while still allowing WordPress core to auto update?
Does having subtrees under the WordPress core repo prevent me from using git to merge in new core updates or pushing out my changes back to the WordPress core repo (if I ever decide I'd like to be a core contributor)?
For plugins that don't have a public git repo, completely ignoring them creates the problem of not being able to quickly clone the entire site on a new server without manually copying files over to the server. It also causes a problem if I want to make changes to that plugin's code those changes aren't tracked and could easily be lost in a plugin upgrade.
So, to summarize, what is a good git+WordPress setup that avoids these problems? I would appreciate your feedback on my proposed project structure. Any way that you can help me improve this, would be much appreciated!
PS, if there is a better forum for this discussion, please point me there.