Best way to deploy to different enviroments?

Hi all,

I was wondering how to deploy to different environments in the best way to do it and how to set, for example, if I want just to deploy my staging (but not my production), how to set up/works this? Or perhaps, If I want to commit it, but I don’t want to place it on my staging or prod environment.

Right now, I just know the way to deploy always in the same place and everytime I do a commit (I’m completely new on this…), and I run a bash script in one of my steps of a simple job.

For another hand, makeing some research, I also seeing this about deployment syntax.

    branch: production
      - bash ./
    branch: master
      - bash ./

This code below, is meaning that every time the push is did from the production branch, it will be autodetected that is from there, and make just the commands of ‘production’?

Thanks in advance, happy saturday.