Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

Is there any way to clone or pull the HEAD version of a module in drupal.org git repository?

For example, if I'm on Drupal 7, and the last branch of Views is 3, I would like to do:

drush git-clone views

to achieve something equivalent to:

cd sites/all/modules/
git clone --recursive --branch 7.x-3.x http://git.drupal.org/project/views.git

Ideally, using drush git-clone views-3x should clone the 3.x branch explicitly.

Is this possible or am I dreaming? This would be really useful for developing.

share|improve this question
add comment

1 Answer

up vote 7 down vote accepted
drush dl views-7.x-3.x --package-handler=git_drupalorg

Update:

True, if there are commits after the dev release was packaged, you will need to run git pull to advance to HEAD after checking out via drush dl. If there is no packaged dev release, and Drush checks out a stable release, then you need to run git checkout 7.x-3.x after drush dl.

There is no Drush command to do a verbatim git clone; part of the "value add" of drush dl is that it grabs published releases. If git clone is what you want, perhaps a short bash script would be your best solution. Something like this:

Usage:

$ clonedev views 3

Example script:

#!/bin/bash

MODULE=$1
VERSION=$2

DRUPAL=$(drush status "Drupal Version" --pipe | sed -e 's/\..*//')
if [ -n $DRUPAL ] ; then
  cd $(drush drupal-directory modules)
else
  DRUPAL=7
fi

git clone --recursive --branch $DRUPAL.x-$VERSION.x http://git.drupal.org/project/$MODULE.git

Modify to suit.

share|improve this answer
    
I've just tried it, and it downloads the latest dev release, not HEAD. And if there is no dev release available, it downloads the latest recommended or supported release. –  Pere Feb 20 '13 at 16:16
    
Okay, see updated answer. –  greg_1_anderson Feb 20 '13 at 17:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.