Run a Local Bleeding Edge WordPress Environment
If you’re an average WordPress user running WordPress to power your site, you’re probably going to want to stick to working with the latest stable version of WordPress.
But if you’re a Power User, or WordPress theme or plugin developer, you’ll be happy to know that you can get ahead of the game by running WordPress “trunk” – the bleeding edge version of WordPress which features the absolute latest code changes implemented by the core WordPress team. You should NEVER run this on a live site since it’s not close to a stable version. You SHOULD use this environment to test your code against future releases of WordPress and prepare accordingly.
The WordPress core team uses Subversion as their version control system, but these days the trend seems to be toward using GitHub as a repository so that’s what I’m using in this example. The WordPress GitHub repo is a mirror of their Subversion repo and is synced with Subversion every 15 minutes.
There’s several ways to go about running WordPress locally and connecting to either the SVN or GitHub repos – for me, this was the easiest to set up and can be done using free tools (bonus!) which are both PC and Mac friendly.
Tools Used
Desktop Server
Premium and Free Version available.
Available for Mac and PC
SourceTree by Atlassian
Free
Available for Mac and PC.
Set Up A Local Install of WordPress
DesktopServer is easily the fastest and easiest way to create a local installation of WordPress on your computer. By all means mess around with MAMP, WAMP etc, but if you want to save yourself a bunch of time, use DesktopServer and get up and running within minutes! Once DesktopServer is installed you’re going to create a new site and name it whatever you want.
Going through the DS installation process does a few things for us: Creates the .dev local url that we will use to access the site Allows you to create your username and password for your experimental WordPress installation Creates the database and the other magic needed to run WordPress locally.
Connect To The WordPress GitHub Repo
If you’re handy with the command line you can use other methods to do this, but if you’re like me and prefer a GUI, SourceTree seems to be the most fully featured and free application to use for managing version control and connecting to code repos. Before we get SourceTree connected to GitHub we have to do a little prep.
You cannot clone a repository into a non-empty folder on your computer. So that means that we have to delete all the WordPress files that DesktopServer installed for us. The exception is the wp-config.php file which we need to keep otherwise our WordPress site will not function correctly. So first of all we’ll temporarily move that elsewhere. I typically move wp-config to my desktop for this step. Then go ahead and delete all the files from the folder of your experimental site.
If you’re on a Mac you’ll need to make sure you can view all invisible files since a .DS_Store file will get created and that needs to be deleted as well. Once your site folder is totally empty you can move on to the next step.
After installing SourceTree start by going to:
File > New/Clone
There are two key pieces of info to fill in – the Source Path and the Destination Path:
For the Source Path enter:
https://github.com/WordPress/WordPress
The Destination Path will be the folder that DesktopServer created on your local computer with your new WordPress installation in it. It’s typically found within a folder named Websites, and each site you create has its own folder. You can use the button to the right of the field to browse and select the website folder:
The bookmark name is purely for your reference so you can label it whatever you want – “WP Trunk”, “WordPress GitHub” etc.
After you’ve filled in the info, click Clone and SourceTree will start pulling down the files from GitHub and putting them into your site folder. When this is complete, you’ll see it listed in your Bookmarks.
At this point you must make sure to move the wp-config file back from your Desktop into the website folder. Once this is done you can log in to your local site and boom, you’ve got the absolute latest version of WordPress running!
Stay Synced With GitHub
To make sure that your local install stays up to date, make sure to open up SourceTree before playing with your site and pull down the latest changes.When you open SourceTree you’ll see a number with a green arrow to indicate the number of new changes there are.
Click on Pull to grab those changes and merge them with your local install. Through the SourceTree interface you’ll be able to see all the code commits and their messages so you can see exactly what’s happening.
So there you go – your very own look behind the WordPress curtain!
Bonus tip: if you’re into this kind of stuff you’ll also want to keep up with the core team’s blog updates here: http://make.wordpress.org/core/