Introduction
Sometimes you want your Jenkins pipeline to do different things depending on which branch of your code you are working on. This helps you test new features safely or deploy only from the main branch.
When you want to run tests only on feature branches but deploy only from the main branch.
When you want to build a different version of your app for development and production branches.
When you want to skip certain steps like deployment on pull request branches.
When you want to notify different teams depending on the branch being built.
When you want to run security scans only on release branches.