I believe that drush features-diff will list the overrides for a specific feature and that drush features-list will list all features. Is it possible to list all of the overrides for all features, perhaps by piping the results of drush fl to drush fd?

If so, how would one pick up the second field from drush fl to pipe to drush fd? Or, is there a better way to do this?

  • Running drush fd with no argument will return a list of overridden features-- I take it that this is not what you want, and that instead you want a list of all the actual changes to the code? – Patrick Kenny May 24 '12 at 16:22
  • drush fda -y is the best answer for this one now, no question in my mind – cdmo Jun 29 '16 at 15:12

In the current version of Drush, you can show a list of all features and their override state with (both short and long versions of commands shown, with and without the "-y" flag to skip confirmation questions):

$ drush features-list
$ drush fl

If you want to show only the overridden features:

$ drush features-list | grep -E "Overridden|Needs"
$ drush fl | grep grep -E "Overridden|Needs"

To show everything that has been overridden for all features:

$ drush features-diff-all
$ drush fda -y

To update all features to their currently overridden state:

$ drush features-update-all
$ drush fua -y

To revert all features to their default state:

$ drush features-revert-all
$ drush fra -y
| improve this answer | |
  • can't edit cause it is less than 6 characters but drush fl | grep grep -E should be drush fl | grep -E – powpow12 Sep 24 '19 at 12:44

Just to share or whatever -- I use it all the time, and I would've loved to come across this tip when I was a noob , so...

I run:

drush fl | grep -E "Overridden|Needs"

...And, I added an alias to my drushrc.php to make it even quicker to call upon:

$options['shell-aliases']['flovr'] = '!drush fl | grep -E "Overridden|Needs"';

That's all, hope it helps someone! (Also, "first time / long time," so if I've done wrong here, please be gentle :) )

| improve this answer | |

I think what you are missing is xargs (available on Mac and Linux, at least). Also, the magic numbers in your cut command are not reliable; use sed instead. It is hard to tell, but I think that drush is outputting tabs as well as spaces, hence the [:space:] character class in the following:

$ drush fd | grep -E 'Overridden[[:space:]]+$' \
| sed -E 's/[[:space:]]*Enabled[[:space:]]*Overridden[[:space:]]*//' \
| sed -E 's/.*[[:space:]]//' \
| xargs drush fd
| improve this answer | |

I'm sure it's possible by piping the results of drush fd or drush fl to grep, which could be used to extract the feature name, then piping that to drush fd, but that is no simple task.

If you're using git, another option is, on a clean working directory, run drush fua and then git diff. You can then run git reset --hard HEAD to get back to where you were. A workaround, but possibly simpler.

| improve this answer | |
  • If it is possible with drush, then I should be getting close. drush fd | cut -c28-51 | tail -n +2 gives a list of features that have been overridden without any of the other fd output columns and without the first row title. However, I can't find a way to pipe that result to drush fd in a way that would give me the detailed results for all overridden features. Is it possible? – Jonathan Sibley May 26 '12 at 3:43

If you'd like to show the code difference for all enabled features not in their default state, use fda command:

drush features-diff-all --force

--force Bypass the confirmations. This is useful if you want to output all of the diffs to a log file.

Other option is to use Features Diff module for that.

This is a simple modules used to view the diffs of a single or all features modules.

To list all Overriden feature modules by parsing the output of feature-list, the syntax can be:

drush fl --status=enabled | grep -o "\S\+\s\+Enabled.\+" | grep "Overridden"

To have both Overridden and Needs review, use: grep -e "Overridden" -e "Needs review" instead.

To get the list of modules, filter by: cut -d' ' -f1.

For longer name of modules, increase COLUMNS variable as names can be cut off.

So to pipe all features into feature-diff (fd), feature-revert (fr), feature-update (fu) or features cleanup (fcf), e.g.

COLUMNS=100 drush fl --status=enabled | grep -o "\S\+\s\+Enabled.\+" | grep -e "Overridden" -e "Needs review" | tee | cut -d' ' -f1 | xargs -t drush fcf

For running it in parallel (to speed it up), add -P4 -L4 into xargs.

| improve this answer | |
  • Should drush features-diff-all --force be drush features-diff-all -y? – cdmo Jun 29 '16 at 15:09
  • You may try -y, however there is a special --force option for it (see: drush help features-diff-all). I think the difference is that --force is suppressing the annoying confirmation message, where -y is still displaying it. So --force is useful when you're logging the differences to the log file. – kenorb Jun 29 '16 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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