I’ve been researching how to use git for WordPress deployment. Nearly all of the examples have WordPress as a remote repository that is merged into master/feature branch regularly.
I don’t want to commit the WordPress core into my repository. I basically want to ignore everything except the files I’ll be changing (mainly my custom theme). Is there a simple way I can do this, but still keep a local, staging and production server running the same WordPress version?
Merging the remote repository isn’t necessary unless you want changes from upstream in your copy.
Suppose you have your WordPress locally in a folder called
wp
and it isn’t already a git repo:Now when you want to reflect these changes remotely just push to the remote of your production or staging servers.
Possible Solution via git Submodules
Say you have your WordPress setup on github. First clone the repo:
Now say you have a theme “awesomeness”:
Now anytime you want to update your theme first update the theme repo:
Back in wordpress just update the submodule and push to github.
On your other servers you can either
git clone git://github.com/Soliah/Wordpress.git && git submodule update --init
orgit pull
if they’re already present.