There are three different environments that you'll probably deal with at some point. Each environment has its own properties and uses and it's important to use them accordingly. Once you know what the environments are used for it'll make since why we have so many of them.
The main three environments are: development, stage, and production.
Development
This is the environment that's on your computer. Here is where you'll do all of your code updates. It's where all of your commits and branches live along with those of your co-workers. The development environment is usually configured differently from the environment that users work in.
It'll be connected to some local database or a dummy database so that you can write your code without messing up the real data. Since there will be multiple people working in the development environment, you'll also handle any branch merging.
Nothing you do in the development environment affects what users currently see when they pull up the website. This is just for you and the other web devs to see how new features will work and to try out improvements.
A lot of preliminary testing will happen in this environment. You don't want to release your code before you make sure it works locally at least. Go through your code as thoroughly as you can so that you limit the bugs that squeak through to the next environment.
Stage
The stage environment is as similar to the production environment as it can be. You'll have all of the code on a server this time instead of a local machine. It'll connect to as many services as it can without touching the production environment.
All of the hard core testing happens here. Any database migrations will be tested here and so will any configuration changes. When you have to do major version updates, the stage environment helps you find and fix any issues that come up too.
If you have a client, this is when you would be able to give them a demo of how things work and look. They will be able to see how things will work when they make it live and they will be able to give you any feedback you need. Think of the stage environment as the place you do the last checks and you polish things up.
Production
Every time you talk about making your project live, this is the environment you are talking about. The production environment is where users access the final code after all of the updates and testing. Of all the environments, this one is the most important.
This is where companies make their money so you can't have any crippling mistakes here. That's why you have to go through the other two environments with all of the testing first. Once you're in production, any bugs or errors that remain will be found by a user and you can only hope it's something minor.
Some people like to do roll-outs to the production environment. That means they release changes to a few users and gradually roll them out the everyone. Not all of your updates have to be released into the production environment at the same time.
In some cases, you might roll out your changes on a schedule to handle load issues or to make sure that there aren't any major issues sneaking through. You can release changes to the production environment without going through the stage environment if there's an emergency although it's not something you want to do regularly.
Different organizations will deal with these environments in their own ways. Some of them have different names or there may be more environments than these. Regardless, you know what you need to in order to make the best use of each of them.
As a side note, I know the stage environment can be a pain sometimes. It takes so much work to set up this fake production environment and write all of the tests for it. Although it is worth the time. It's better to go ahead and get this step over with because it'll save your butt more than you'll ever know.
Hey! You should follow me on Twitter because reasons: https://twitter.com/FlippedCoding