Managing WordPress via git

I reorganized my self-hosted WordPress system to use git to manage the WordPress code and to move the content outside of the WordPress directory. That way I should be able to do a simple git pull and git checkout $newversion to update my WordPress. I’m also keeping my content directory under change management (separately) so that I can update plugins through the web and be able to roll back.

  • $HOME/blog/wordpress is a git clone of git@github.com:WordPress/WordPress.git. I make no local changes in this. In particular, all of wp-content is unchanged (I make it unwriteable by Apache to be sure).
  • $HOME/blog/content is a copy of the wp-content of my site (prior to moving it outside the wordpress code). It contains the usual: plugins, themes, uploads. It’s all writeable by Apache so that I can update plugins and themes through the web.
  • $HOME/blog/wp-config.php is the usual config file (WordPress looks in the parent directory for it). It’s standard except for two settings:

    define('WP_CONTENT_DIR', '/home/fred/blog/content');  
    define('WP_CONTENT_URL', 'http://fred.yankowski.com/content');
    
  • /etc/apache2/conf.d/wordpress.conf defines the VirtualHost for the wordpress site. It has an alias to support special location of the content. (It also has the mod_rewrite rules for permalinks so that I don’t need an .htaccess file in the wordpress code).

    DocumentRoot /home/fred/blog/wordpress
    Alias /content /home/fred/blog/content
    

Leave a Reply

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax