When you configure g0/1 as a trunk the result is that all vlans are allowed on the trunk. When you add the command
switchport trunk allow vlan 20
the result is that only vlan 20 is allowed on the trunk. All other vlans are not allowed on that trunk.
We do not know much about your environment and what you are attempting to achieve. But if you have a server and you want only vlan 20 to be able to access the server then I would suggest that a good solution would be to use an access list to restrict access.