Drupal Version Control

Printer-friendly versionPrinter-friendly version

(notes from a session at the DrupalCon 2010 Unconference)

slides at http://michaelcole.com/drupalversioncontrol

  • purpose: go back and forth through time
  • 3 basic commands: commit, update, diff.  "all the rest is accounting"
  • for Drupal, two key systems: CVS (core and contrib) and Subversion (everybody else)
  • setup a server in 30 seconds: unfuddle.com, cvsdude.org, assembla.com
  • client tools are usually command-line. 
  • Quick start
    1. set up the server (see above) if not using an existing server -- get a "project" URL
    2. install client and checkout URL to a local folder
    3. make changes.
      • create "trunk" folder for current version
      • when dev version is 2.x, 1.x will be in a "branches" folder
    4. commit changes (easier with GUI)
    5. Teamwork!
      • update before commit!  Last person to update "loses"!
    6. conflict resolution - use diff to compare conflicting code
    7. review log. Not just a backup, it's a file system through space and time!
  • Questions & Tips:
    • use Backup & Migrate module to save database into file system so that it gets added to repository
    • for production data, data comes "down," only code goes "up"
    • drush can do a lot of this stuff, including committing from dev server's command line to production server