drush dl [project-version]

drush dl module_filter-7.x-2.x-dev

There may be times when you want to update (or downgrade) to a specific version of a module. This may be downgrading to the last version that worked for you, if the current version has issues. Or you might do this to update to the dev release to take advantage of a bug fix while you're waiting on a new stable release. You might also want to update to a new major version of a module, for example, from the 1.x branch to the 2.x branch. I'm going to do that with the module_filter module.

First, I'll enable Module Filter since Drush only checks for updates of enabled modules.

  • drush en module_filter

If we check the modules page, you'll see that it is indeed enabled, and that we have the 7.x-1.7 version installed. Let's go ahead and run the drush command to install the 2.x-dev version.

  • drush dl module_filter-7.x-2.x-dev

Drush will notify you that the module already exists, and asks if you'd like to overwrite it. I'll type "y" and push enter. And we should now have the 2.x version of the Module Filter module installed. Let's refresh our module page and check it out.

Sure enough, we now have the 2.x-dev version installed, but it looks like we need to run the update script, so I'll do that now.

  • drush updb

Now when we refresh the modules page, everything is up to date and ready to go.