I use tags to deploy to a specific environment using a block
only:
- tag1
- tag2
But tags can be placed in different branches.
Therefore, a situation may occur when a developer puts the "prod" tag in his branch and the deployment goes to prod environment.
Is there a way to prevent this, or somehow make sure the tag belongs to a specific branch?
To answer your question: There is no way to ensure a commit only belongs to a specific branch. This answer however may point you in the right direction to solve your problem.