Local makes it easy for you to quickly get to the business of creating and managing a WordPress site on your local machine and lets you efficiently deploy your site to remote servers on Flywheel and WP Engine. Even if you don’t use Local to publish your code (maybe you prefer to use a service like DeployHQ, DeployBot, Buddy, or GitHub actions to deploy your code) it’s still a great tool for running a local server so you can test your code as you develop it locally.
But what if you want (or need) fine-grained control of the edits that are made to the code used on your site? What if you need to merge in different changes made to the same file by multiple developers?
That’s where version control systems like Git really shine. They’re a great way to keep track of changes made to your codebase. These tools allow you to track changes and collaborate with other developers when working on the same code.
Let’s walk through how to configure a site running in Local to make use of GitHub so that you get the best of what these two tools can offer your development workflow!
Git, GitHub, Github Desktop, GitLab, etc. what’s with all the similarly named but different things here? Well, Git is a version control system that powers several version control services like GitHub, GitLab, and more. To make matters even more fun, Git isn’t the only version control system out there, though it is probably the most popular. We don’t want to go too far down that particular rabbit hole, but if you’re new to this, it can help to know a bit more about the world of version control.
If you’d like to dive in a bit further into the differences between all of these, check out these resources:
Git is the most popular version control software and GitHub is the largest Git host, which is why we’re going to focus on using it with Local for this tutorial. GitHub Desktop is great for those of us who prefer a more visual interface over the command line, so we’re going to use it here too. If you’d rather use the command line for your Git workflow, you can use that instead.
Note, if this is your first time using GitHub and you haven’t already signed up, you’ll first need to create an account on GitHub. You’ll also need to install Git on your local machine so you can run Git commands locally.
Open Local, click the plus sign (+) in the lower-left corner and fill in your site details to create your new site.
For our purposes here, Local’s really just going to be used to run the site so you can easily test your theme or plugin code, which you’ll manage in your Git repository.
cd wp-contentto navigate to your site’s wp-content directory. If you only want to manage a theme or plugin in your repository, navigate into that theme or plugin directory (
git initand hit return/enter.
Now you’re ready to add the repository in GitHub desktop. If you prefer to use the command line to manage your repository, feel free to skip the rest of this help doc.
So that you can manage your repository in GitHub Desktop, you’ll first need to add it there.
Commit your repository via GitHub desktop by entering your Summary (initial commit is pretty standard for a repository’s first commit) and clicking “Commit to master.”
git branch -m newnamein the command line.
Now that you’ve committed your changes to your local repository, you’re ready to publish/push those up to your GitHub repository.
Now that you have your Git repository set up locally and at GitHub, what’s next? To get the most out of your new version control setup, we recommend defining your workflow, based on best practices and the needs of your team. Use the following resources as inspiration for creating your optimal workflow:
When you’re ready to deploy your repository from GitHub to Flywheel, check out these handy help docs and resources:
It’s free and always will be.
Thanks! We'll contact you as soon as Local for Windows is available.
Next-level functionality and enhanced local development.
Sign up below and we’ll notify you the minute Local Pro is available for beta! Launching July 2019.
Thanks! We'll contact you as soon as the beta is available.
Local is only available as a desktop application, but no worries! Just enter your email in the box below and we'll send you a little reminder to download it via your desktop.
Thanks! Check your inbox for a link to download Local on your desktop.