What are the best ways to sync (and version control) existing WP sites to local instances?
-
I am trying to create local versions of existing WP sites, and also incorporate Git for versioning (my first time officially, meaning I am 99% newb.). Some of the sites are hosted on WP Engine, but many are on traditional hosts. Firstly, I am running into major problems when I try to mirror an existing site locally; even when importing all WP files, xml, plugins, settings, etc - the sites never align correctly. Local is always a complete mess and not even close to usable. I guess there are 3 parts to this question: 1. What are the steps to best mirror an existing live WP site locally? (Assuming I already know how to set up the local server with MAMP, etc). 2. How can I use Git to be able to push changes live? (I have very very basic working knowledge of Git - I have set up repos and such to learn from, but never for real live development - yet). 3. Since I use WP Engine for hosting in some cases, are there different ways to go about all of this? I.e., would using their Staging environment be an alternative to creating a local instance of a site? Or is it in addition to? Thanks everyone in advance! This is my first Quora interaction, please let me know if I can improve anything.
-
Answer:
First thing's first. If your a Git n00b, familiarize yourself with Git before you do anything. It's hard to break stuff with Git (well, harder than it is with other systems) but if you don't know what you're doing, particularly since some of this is going to be doing things like typing git initgitâitgit init into a commandline via ssh, you won't get very far. The be-all, end-all resource for that is the official documentation here: http://git-scm.com/documentation GitHub also has some good documentation and tutorials: https://help.github.com/ Now that that's out of the way... The cool thing about Git is that each instance is a separate repository. If you were proposing to do this with SVN, for example, you'd have a central Subversion repository, you'd check out a copy of that repo to your own local environment, make commits to the central repository, and then need to set up some kind of deployment system where your repo is able to push changes out to your website. It's possible, and there are some services that let you do this that make it pretty easy. With Git, on the other hand, you can have a repository that you start on your local environment and create a clone of the repository remotely on your website. Then, when you commit changes, you can push those changes to your website. So, the fact that you're planning on doing this with Git is good, because it's much more feasible with Git than another version control system. So, for 1 and 2 of your question, basically you just create a repository and clone or upload that repository to your live site, then set that up as your remote repository that you'll be pushing commits to. The only caveat is that you'll need SSH access to do any of this stuff. But if you have that, here's a good resource for using Git to manage a site: http://toroid.org/ams/git-website-howto A caveat for WordPress: You may or may not want to keep your plugins in sync. The reason for this is if they ever get out of sync (e.g. you don't update your plugins on your localhost but you do on your live site) you can end up pushing old copies up to your live site, which is bad. Plus, it's a lot of extra stuff to upload that you really don't need to do. Since WordPress takes care of automatic updates, unless you're actively developing some of those plugins yourself, better to add them to your .gitignore. Same goes with themes (that you aren't developing) and pretty much anything that's not in /wp-content/. I haven't used WP Engine, so I don't know the specifics of their environment or what they offer. Maybe those guys will jump in and answer that part. :) Hope that helps!
Chris Reynolds at Quora Visit the source
Other answers
You'll want to check this related Quora thread:
Jeremy Herve
Related Q & A:
- What are the best ways to advertise your Website?Best solution by Yahoo! Answers
- What are the best ways to search for jobs?Best solution by Yahoo! Answers
- What are the best ways to beat flu?Best solution by Yahoo! Answers
- What are the best ways to do marketing via internet?Best solution by Quora
- What are the best ways to find a job with a social entrepreneurial company?Best solution by answers.yahoo.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.