Get control of WordPress with version control, WordCampPhilly 2011
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
wordpress-version-control.key
wordpress-version-control.pdf

README.md

Get control of WordPress with version control

Overview

This presentation will help you get your WordPress sites, plugins, and themes under control with version control. Learn the finer points of tools like Subversion and Git. And find out how to share your code with the community for collaboration.

Presented at WordCamp Philly 2011

Put together by Dave Konopka. On Twitter: @davekonopka

Version Control

  • Why bother with version control?
  • Tools: The options
  • WordPress under control
  • Workflows
  • Q & A

Version Control

Why Bother?

  • Work with a net
  • Manage streams of work
  • Collaborate (even if only with your future self)
  • Synchronize between people and environments
  • Commitment: You have to commit to using version control to get benefits

A version control refresher

  • Respository
  • Code lines
  • Commits
  • Tags
  • Branching, merging
  • Diffs, patching
  • Remotes

Tools: The options

Subversion

  • WordPress is heavily invested in SVN
    • WordPress code, plugin directory
  • Doesn't mean you need to use SVN
  • Centralized
    • Must be connect to repository to work
  • Slower
  • Painful branching

Git

  • Popular
    • 1 million users on Github
    • 163K Ubuntu package installs according to popcon
    • Included with OSX dev tools
  • Github
    • Linux, Ruby on Rails, jQuery, etc… hosted
  • Distributed
    • Work disconnected
    • Connect when you want
  • Faster
  • Shape your history
  • Easy branching

Some Git terms

  • Command line is your friend, learn there if you can then go gui
  • Git is a collection of command line tools
  • .git folder
  • Clone
  • Staging area
  • Remotes
  • Push/pull

WordPress: Under control

Manage custom plugins, themes

  • Clone = install
  • Push from dev, pull on server

Publishing to WordPress plugins directory

  • Each plugin is an SVN repo
    • Latest trunk or specified tag zipped up every 15 minutes
  • git-svn
  • Use diff tool to apply changes to SVN checkout
  • Publish to Github for additional exposure

Manage an entire WordPress site

  • Site is a repo
    • Master = WordPress code
    • MySite branch = customizations
  • SVN externals
  • Git submodules
  • Ignore dynamic pieces
    • wp-content/uploads
    • wp-config.php
    • etc…
  • Workflow of applying WordPress updates
    • Checkout master, delete all files, post code
    • Commit
    • Checkout working branch, merge in master
  • WordPress on Github

Contributing to projects

Deploy

Databases

  • Version control does not serve databases well
  • Mysqldump, track script
  • Plugins for managing data/content migration

Workflows: Pleasure principal

  • Keep public branches clean, be thoughtful with commits
  • Branch all the time
  • Feature branch
    • Create a branch
    • Commit as often as you want
    • Once ready to ship, clean up the branch history
    • Merge in a single, or a few, clean atomic commits

Resources

Hosted services

  • Github
    • Hosted Git repos, free public repos
    • Collaboration & projest management tools
  • Beanstalk
    • Hosted Subversion, Git repos
    • Collaboration & project management tools
    • Philly based company
  • BitBucket
    • Unlimited free private respositories
  • Unfuddle
    • Hosted Subversion, Git repos
    • Free private repos
    • Collaboration & project management tools

Guides

Applications

SVN

Git

Credits

Photographs