The only and except job parameters are used to limit when a specific job is run. only is used to limit a job being executed to a specified branch or tag names, while except is the opposite: the job will always be run unless it's on a specified branch or tag. The value for this parameter can be defined with a regular expression or a special keyword such as branches to refer to all branches, tags to refer to all tags, and so on. For more reserved keywords for only and except, please refer to the GitLab CI documentation online.
Please note that only and except don't have to be mutually exclusive either; you can use a combination of them to have more fine-grained control over when a job will be executed. An example ...