WordPress webdesign and development in Houston Texas

WordPress development with Git

An introduction to developing WordPress themes and plugins using Git version control

Adding Git to your WordPress development workflow - an introduction

Step 4: Deploying to a live server

For this article I’m going to cover a very basic deploy strategy that uses the master and origin branches. There are more advanced methods like Capistrano and multiple branches for staging and production that I will cover in future articles. See the Git Reference for more info on working with branches.

Moving to our live server were going to clone repo. This assumes the production environment lives on the same server as the remote repo or we have generated a working SSH key pair to access the remote repo.

cd {root public dir}
git clone ssh://[email protected] .

Now anytime you make updates SSH into the live server and run:

git fetch origin
git merge origin master

If you ever need to rollback a change you can quickly do a git reset -hard your_sha. Your_sha represents a commit and to find the previous commit to roll back from run git log. This will output recent changes. Find the most recent “Merge remote branch” message and use the sha (long number after the commit message) to run your git reset command.

Hopefully this article gives you a basic understanding of how version control with Git works. This should give you a good start and keep you from wearing the “Pink Sombrero” I would love to hear how you use version control in your WordPress development workflow and welcome any comments or suggestions.

Resources used for this article:

Pages: 1 2 3

1 Responses »


    1. Adding Git to your WordPress development workflow | C3M Digital on

    Leave a Response