When building Features, i find it useful to keep a 'backup' of the full configuration and commit it to version control.

If something breaks when i package a feature after i test how it works by doing a full re-install of the profile that brings together the feature modules, i can restore things i missed from the configuration export.

Unfortunately, every site install produces different UUIDs in every configuration file, so i cannot use a diff to determine if there are missing or unexpected changes in the site-install version of the configuration i packaged up. Drush does not have an export option to strip UUIDs on export.

In the past we used a script to delete all the UUID lines, but not being built into Drush, it was Python or Bash i think, it was awkward to use. But if i find it i'll post it.

How can i get a clean diff of changes that filters out the noise of the UUID changes?

  • Meant to mention, related but not the same as my goals here, drupal.stackexchange.com/questions/177139/…
    – mlncn
    Commented Jul 24, 2019 at 0:35
  • 1
    FYI: Since v8.6.0 there is now an explicit flag drush site:install --existing-config, which ignores the existing/mismatching UUIDs. This way you can an existing foreign site, without the content.
    – Hudri
    Commented Jul 24, 2019 at 12:49
  • @Hudri yep, well aware of it, and we were doing the same thing by some trickery in custom profiles for regular sitebuilding even before drupal.org/project/config_installer came along. The use case here is quite different: building Features, so repeatedly re-installing normally (not from the exported config), but wanting to export the config and compare exports as a check on our Feature packaging skills. Would still really prefer just a drush config export command that would skip the UUIDs :-/
    – mlncn
    Commented Jul 26, 2019 at 13:32

2 Answers 2


For that interim step, when you just need to glance over the changes in your exported config, git diff -I"^uuid: " -- config/sync will return a succinct list that ignores the changes in any line starting with 'uuid: '.

from the doc page on Git-diff:


    Ignore changes whose all lines match <regex>. This option may be specified more than once.

but wait... there's more!

The deluxe version of this command ALSO filters out file deletions & the config_hash, making the diff up to 76.3% more succinct (heh) -- all for FREE:

git diff -I"^uuid: " -I"config_hash" --diff-filter=MRC -- config/sync

And here's the doc reference for --diff-filter:

--diff-filter=[(A|C|D|M|R|T|U|X|B)…​[*]] Select only files that are Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R), have their type [...]


The use case in question here is for building features; the config/sync directory is never used to import, but it can be used to check if the result of a site install is about what we expect (and to copy wanted files or changes we wanted to keep, and missed, from a saved version).

The meaningless UUID changes in every file, however, make it impossible to find that information in all the noise.

Here is a workaround that presumes you are using Git for version control, exporting configuration and committing it, then running a site install, and re-exporting the configuration (but not yet committing it):

git diff -G '^[^u]*([^u][^i][^d][^:]).*'

will show only files with non-uuid changes. If there's a change to a uuid other than the one for the configuration as a whole (that is, indented under some other part of the configuration), that will be shown.

Super unsure about the regex in this but it's not had a false negative or positive yet.

Here's what i have in my .bashrc to make this easier to use:

# Diff that ignores config files whose only change is the UUID (ignores lines
# starting with 'uuid:' and probably other stuff but it's solid so far.)
alias gdu="git diff -G '^[^u]*([^u][^i][^d][^:]).*'"

Took me forever to come up with this workaround; hope it helps others.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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