As far as I understand, /etc/alternatives stores only currently selected alternatives. Where are all the variants and all the metadata stored? I have accidentally removed an alternative with galternatives and want to add it back as it was manually (as galternatives functionality is very limited).

A more detailed description of how the alternatives system works, including where it stores all its configuration, is available in the update-alternatives manpage (note that this version for Debian and Ubuntu contains more functionality than the update-alternatives from redhat).