Run the following to get rid of a module if you changed the branch without first uninstalling the module properly:
drush eval '$module_data = \Drupal::config("core.extension")->get("module"); unset($module_data["MODULE_NAME"]); \Drupal::configFactory()->getEditable("core.extension")->set("module", $module_data)->save();'