Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've been using git to track changes in the plugins and themes I've developed for different sites. Each plugin or theme has their own repository in whichever local install of WordPress I happen to be using for that project. This works fine when I'm just working on one solitary plugin or theme.

But when I have a local version of an entire site which is a collection of different plugins, themes, WordPress core, etc. Should I be keeping that entire directory under version control?

Is there a best practice to always have a collection of repositories for each theme/plugin, or for each client site to have one monolithic repository that includes all the code used in the project (including the latest copy of WordPress via svn.)

share|improve this question

3 Answers 3

There's no set best practice, as each model fits different work processes.

One Repository

If you're only managing a single site with a single set of plugins/themes then a single repository makes sense. Or if you're managing multiple sites that use the same set of plugins/themes.

Multiple Repositories

This is my personal preference.

Keep WordPress core under SVN version control so it tracks the official repository. Then check out/clone each plugin or theme as needed separately.

I often clone all of my plugins via Git to a special folder on my machine, then symlink each to folders in /wp-content. Not the prettiest way to do it, but I can use one local copy of a plugin in multiple, independent test installations of WordPress.

share|improve this answer
    
What about for things like wp-config.php? Mark Jaquith has talked about having everything under version control –  jjeaton Apr 4 '12 at 11:08

Use one repository for your site, and then add each theme/plugin repository as git submodules.

This way you have one repo that represents an entire site, but you do not have code duplication.

The same is true of SVN, use svn externals in place of git submodules.

As EAMann mentioned, it is a good idea to use symlinks/junctions on a central folder containing your repos if you have a lot of instances of them.

share|improve this answer
    
So is there a way I can have an entire site under git, yet have WP core checked out with svn, and then all my themes and plugins as git submodules? –  jjeaton Apr 4 '12 at 11:09
    
Not directly, you would need to instantiate git repos yourself, BUT there is a workaround! If your stuff is on github, then you can use the github svn compatability layer to access your git repos as if they were an svn repository and add thema s externals ( though you would need to duplicate the wordpress SVN to add the externals, in which case why not fork github.com/WordPress/WordPress ) –  Tom J Nowell Apr 4 '12 at 11:11

Best practice of life is avoiding duplication of useless data.

In common

For each project, based on any public third-party code you can save only part, which convert this project into solution from default vanilla distro. In my case, I'll store only my changes to upstream core (if they exist) and own added code

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.