Test multiple WordPress versions with one installation

I write my plugins on trunk, I’m using always the latest version, updated daily. When something breaks, I can ask or open a ticket early enough, so my users don’t get in trouble when they are upgrading to the next WordPress release. But at the same time, I have to make sure that my plugins work with the current release and with minor updates like from 3.8.2 to 3.8.3. I use just one WordPress installation for that. How?

Git to the rescue. There is a mirror for WordPress on GitHub. It is kept in sync with the SVN repository every 15 minutes. Close enough.

Let’s create our local installation from that:

# clone WordPress into the directory 'wp'
git clone git@github.com:WordPress/WordPress.git wp
# get all the tags
git pull --tags

Now we create a wp-config.php, put it one level higher than the WordPress directory. Then we put a file named .gitignore into the directory itself with the following content:

.gitignore
.htaccess
favicon.ico
wp-content/debug.log
wp-content/languages
wp-content/uploads

We can install WordPress now per browser.

Now we are on the branch master, the latest development version. Whenever we want to switch to another branch or a specific release (tag) we can do that in our console very fast.

Switch to another branch …

git checkout 3.4-branch

… or to a specific release …

git checkout tags/3.4.2

… test our plugin, and then switch back:

git checkout master

To get the latest changes into our local repository, we just call ever day:

git pull

That’s all.

Author:

Web developer since 1998, moderator on WordPress Stack Exchange, author, manic reader.

Code is my drug.

Find Thomas Scholz on toscho.de⁠, ⁠, ⁠, ⁠, ⁠, ⁠, and .

4 Comments

  1. Leho Kraav @lkraav17.04.2014 18:24

    Single database?

    Reply

  2. Darshan Sawardekar19.04.2014 07:11

    Working on Trunk is living on the edge. :)

    I’m using more or less the same workflow, except I am on the current stable release branch. I have a few aliases setup to do faster switching of branches.

    Reply

  3. Frank22.04.2014 14:25

    I use it also, combined in a repository to define path to wp-content, plugins, mu-plugins.

    Reply

Leave a Reply

Your email address will not be published.