Warning message

Documentation is currently being migrated into the new system. Some pages might be temporarily missing, and some guides might appear empty. Thank you for your patience while we are improving Drupal.org documentation.

Features & Drush

Last updated on
August 17, 2016 - 21:32

Features offers some useful drush commands which can help streamline your development even further. (Drush is a command line shell and scripting interface for Drupal.)

The drush commands Features offers are:

explanation: List all the available features for your site.
aliases: fl, features
example: drush features

explanation: List features components.
aliases: fc
example 1: drush features-components List feature components matching patterns. The listing may be limited to
exported/not-exported components.
example 2: drush features-components --exported Show only components that have been exported.

explanation: Export a feature from your site into a module. If the feature exists, new components are added into that feature.
aliases: fe
Syntax: drush features-export name_of_feature component1 [component2...]
Example: drush fe my_new_blog_feature views_view:view_name

To get a list of components, use the above features-components command.

explanation: Update a feature module on your site. The update operation will produce a modified version of your feature module, which matches up with the configuration found in the database.

What happens with this modified code, depends on whether you do this with drush or with the web-based interface.

Using drush ("drush features-update [name]"), the modified code will replace your existing feature module in the filesystem.

The "recreate" button in the web-based administration interface is the equivalent to "update". However, the modified code will be provided for download as a .tar archive, instead of overwriting the existing feature module. It is up to the site builder to manually unzip and re-upload the modified module, replacing the original.
aliases: fu
example: drush features-update NAME_OF_FEATURE_TO_EXPORT

explanation: Update all feature modules on your site. From database to the code.
aliases: fu-all, fua
example: drush features-update-all

explanation: Revert a feature module on your site. Revert changes your site configuration (living in the database) to match up with the definitions in the feature module code.
aliases: fr
example: drush features-revert NAME_OF_FEATURE_TO_REVERT

explanation: Revert all enabled feature module on your site. From code to the database.
aliases: fr-all, fra
example: drush features-revert-all

explanation: Show a diff of a feature module.
aliases: fd
example: drush features-diff NAME_OF_FEATURE_TO_EXPORT
example 2: drush features-diff NAME_OF_FEATURE_TO_EXPORT --lines=NUMBER_OF_LINES_OF_CONTEXT

Information taken from features.drush.inc in Features module bundle.
You may find more information on this external site.

You can also use -y to respond automatically Yes to confirmation dialogs e.g.
drush fra -y

explanation: While not a command specifically provided by the features module, this command enables a feature.
example: drush en my_feature