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
- Patches
- Github
- Fork a repo
- Go wild in your fork
- Submit pull requests
- Gists
Deploy
- Manual pull on server
- Remote git repo, push updates code
- Capistrano, Chef
- Post commit hooks
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
- Beanstalk Guides "Everything you need to get started with Subversion or Git."
- Github Help
- Version Control with Subversion free book
- The Git Community Book
- Pro Git free book
- Git Magic
- Think Like (a) Git
- git ready
- Git Is Simpler Than You Think
- WordPress Codex: Using Subversion
Applications
SVN
- RapidSVN Cross platform SVN gui
- Versions OS X SVN gui
- TortoiseSVN Windows SVN tool
Git
- GitX (L) OS X Git gui
- Github for Mac OS X Git gui
- TortoiseGit Windows Git tool