This is one of those mistakes you only make once. usermod -G on its own doesn’t add a group. It replaces the whole list of extra groups.
See what happens with a test user:
sudo usermod -aG sudo alice
id alice
sudo usermod -G users alice
id alice
After the first command alice is in sudo. After the second she is in users and nothing else. Her sudo rights are gone, and so are any other groups she had, like docker or www-data. On your own account over SSH that can mean losing sudo on a remote server.
The -a flag means append, and it only works together with -G. I’d write them as -aG so they stay together:
sudo usermod -aG docker,media alice
Several groups go in one comma list without spaces.
If it already happened, there is no undo command. Look up the old memberships in a backup of /etc/group; Debian and Ubuntu keep a copy of the previous version as /etc/group-. Compare the two and add the groups back with -aG. If you removed your own sudo access, you’ll need another admin account, a root login or a console to repair it. Before you run usermod on your own account, keep a second root session open.
Further reading: usermod(8) manual page