Drupal and Git: A collaborative development workflowPresentation Transcript
--- Drupal and Git
+++ A collaborative development
Wesley Penner and Joshua Schroeder
Drupal Camp Alberta 2010
September 11, 2010
A brief history
๏ We build Drupal sites...
๏ ...on shared development servers...
๏ ...and it usually works reasonably well.
When it doesn’t work
๏ We want a good code history
๏ Old [production] sites need new features
๏ Working on a large product with discrete use
We’re book smart...
๏ Our vision at the time of proposing this
๏ ...vs. our reality in the past few months.
๏ We don’t really know what we’re doing...
๏ ...but here’s what we’ve learned so far.
Control your code
๏ Are you using a version control system?
๏ CVS, SVN, Git, Mercurial, Bazaar
Why choose Git?
๏ If it’s good enough for Drupal.org...
(Maybe not the best justiﬁcation. Case in point: CVS)
๏ But if you’re a contributor, you’ll be using it
๏ Distributed version control. Commit anywhere.
๏ Easy branching and merging
๏ Efﬁcient, even with large projects with long
๏ Tell git who you are:
$ git config --global user.name "Your Name Comes Here"
$ git config --global user.email email@example.com
Seven Basic Commands
๏ These commands are a must
๏ add / commit
๏ push / pull
๏ clone (--bare)
Getting Git Going
The trouble with Drupal
๏ Conﬁguration and settings stored in the
๏ How can you collaboratively build a site?
Shared dev sites
๏ Who broke the site?
๏ Somebody overwrote my work.
๏ How do we push out updates to a production
๏ Troublesome code is sandboxed
๏ Pushing to production is even worse
๏ How to keep developers’ local copies in
๏ Puts the site conﬁguration entirely into a text
๏ Can now be version controlled
๏ Provides a revision history
๏ Make comparison easier by using
drush sql-dump --ordered-dump
Ever try to
merge on a
Ever try to
merge on a
Features to the rescue
What’s a feature?
“A feature is a collection of Drupal entities
which taken together satisfy a certain use-
Ok, so what’s a feature?
๏ A module that bundles conﬁguration
๏ Your conﬁguration is now code-based
๏ ... and version-able
๏ Used to create a literal feature
๏ e.g. image gallery, blog, top story rotator
A basic example
๏ Majority of contrib modules aren’t compatible
with Features yet
๏ “Features provides a UI and API for taking
different site building components from
modules with exportables and bundling
them together in a single feature module.”
Make it exportable
๏ The more of us that build in support for
Features, the more useful Features becomes
๏ CTools exportables
How do I do that?