moodlehq/moodle-local_dev — comment on commit dea87f7349ca533703c5b6f305ed0785bac821ee
File: cli/sync-cohorts.php line 31
By amosbot:

This is not enough. The table {dev_git_user_aliases} provides just explicit mappings - that is a mapping based on some additional email address than the one currently used by the user at moodle.org. If some developer has the same email in the Moodle profile and in the Git commit, no alias is created for them and the userid is stored directly in {dev_git_commits}

So we need something like

SELECT DISTINCT userid FROM {dev_git_user_aliases} UNION ALL SELECT DISTINCT userid FROM {dev_git_commits}