Git drupal:// URLs for projects and sandboxes

Jan 10 2012

In a previous post, I showed an example of cloning a module that included this command: git clone drupal://drupalcs. But I neglected to explain how this worked. I'm not sure where I picked this up (it was probably from Sam Boyer), but by adding a few lines to your ~/.gitconfig makes checking out Drupal projects and sandboxes easier:

This allows you to use drupal://PROJECT_NAME to identify a project (module, theme) git repository, and drupalsand://USER/NID to checkout a sandbox. For example, I can clone one of my sandbox projects with this command, executed at the command line:

Perhaps this sort of syntactic sugar isn't for everyone, but I find it to be a nice configuration short-cut.
<!--break-->
Of course, there's no reason you need to restrict this to Drupal. If you frequently use other Git remote repositories, a similar convention can be used for generating shortcuts. I have such shortcuts for HP's internal repos. And it would be easy enough to create a scheme like that for GitHub or other hosted repo sites.

If you're the one who came up with this scheme, let me know. I feel bad for not being able to give due credit.