How can I deploy a WordPress site with Git without committing WP core? How can I deploy a WordPress site with Git without committing WP core? wordpress wordpress

How can I deploy a WordPress site with Git without committing WP core?


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:

cd wpgit init .touch .gitignore # Add required stuff to .gitignore.git add .git commit -m "Initial commit."

Now when you want to reflect these changes remotely just push to the remote of your production or staging servers.

git push staging master

Possible Solution via git Submodules

Say you have your Wordpress setup on github. First clone the repo:

git clone git://github.com/Soliah/Wordpress.gitcd Wordpressgit checkout origin/3.2-branch

Now say you have a theme "awesomeness":

cd Wordpressgit submodule add https://github.com/Soliah/awesomeness.git ./wp-content/themes/awesomenessgit submodule initgit submodule update

Now anytime you want to update your theme first update the theme repo:

cd awesomeness# update some stuffgit add .git commit -m "Update theme."git push origin master

Back in wordpress just update the submodule and push to github.

cd Wordpressgit submodule updategit commit -m "Update theme submodules."git push origin master

On your other servers you can either git clone git://github.com/Soliah/Wordpress.git && git submodule update --init or git pull if they're already present.