In essence, you simply set up your environments within the GTM settings, and then copy the snippet for each environment - or you can use the 'share preview' link for each environment if that isn't possible to do.
Once you have the environments set up, when you publish changes to a container, you are asked which environment you wish to publish your changes into - et voila!
Setting up environments
Log into your Google Tag Manager account and find your container. Open up the relevant container, and click on 'Admin' on the top menu bar. In the middle settings box toward the bottom you will find 'environments'. Click on this to open up your environments.
Click on 'New' to create a new environment, and complete the fields as appropriate to your environment. You may wish to enable debugging on your development area - it's optional.
Once you create the environment, you will have a popup explaining that you can either use the 'share preview' feature to test the tags in this environment, or you can add the snippet to your website. Click to move forward, after which you will be presented with the list of environments. It's worth mentioning here that you can't edit the default environments - only your custom environments.
If you click on the 'Actions' drop-down arrow for the environment you just created, there is an option to copy the container snippet - this allows you to embed the environment container within the development environment of your website.
Setting up multiple environments
There is every possibility that you might need to set up multiple environments - for example, we have development, demo, and production environments for most projects. Simply repeat the process above as many times as you need to generate the separate environments!
Working with environments
Once your environments are set up and running, each time you publish a change in a container you will be prompted to select which environment your changes should be published into. Take this step slowly and make sure you check every time you deploy changes, which environment you are pushing them into!
Made a mistake?
You can always roll back to your previous container version, by clicking on 'Versions' in the top menu, and identifying the previous version that you need to roll back to.
Simply select 'Publish to' and choose the environment that you need to roll back. Once this is completed, you can repeat the original deployment to the correct environment via Actions>Publish To on the latest environment, and all should be well with the world!