Upgrade Your Drupal Skills
We trained 1,000+ Drupal Developers over the last decade.
See Advanced Courses NAH, I know EnoughGit drupal:// URLs for projects and sandboxes
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:
[url "ssh://[email protected]/project/"] insteadOf = "drupal:" [url "ssh://[email protected]/sandbox/"] insteadOf = "drupalsand:"
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:
$ git clone drupalsand://mbutcher/1356522 Cloning into 1356522... remote: Counting objects: 988, done. remote: Compressing objects: 100% (466/466), done. remote: Total 988 (delta 463), reused 878 (delta 404) Receiving objects: 100% (988/988), 242.04 KiB | 354 KiB/s, done. Resolving deltas: 100% (463/463), done. warning: remote HEAD refers to nonexistent ref, unable to checkout.
Perhaps this sort of syntactic sugar isn't for everyone, but I find it to be a nice configuration short-cut.
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.
About Drupal Sun
Drupal Sun is an Evolving Web project. It allows you to:
- Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
- Facet based on tags, author, or feed
- Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
- View the entire article text inline, or in the context of the site where it was created
See the blog post at Evolving Web