title: How to let Jenkins pipeline build only for given branches
body: <p>In the following pipeline, I am trying to check out only develop branch to build the given project. How do I make sure that the pipeline only run develop, master and release branches?
  Should I add separate stages for master branch and another for release branch. Instead I am trying to let this pipeline build only when there are changes in develop or master or release branches and ignore building for any other branches.</p>
  <p>In Jenkins &gt; Freestyle project &gt; Source code management &gt; Git &gt; User can enter specific branches in Branch specifier. How can I implement similar one using pipeline?</p>
  <pre><code>pipeline {
  agent any
  tools {
      maven &quot;${mvnHome}&quot;
      jdk  'jdk8'
  }
  stages {
  stage('Checkout project') {
      steps {
          git branch: 'develop',
              credentialsId: 'someid',
              url: 'https://project.git'
      }
  }
  
      stage('build') {
          steps {
              sh '''
               mvn clean deploy
              '''
              }
          }
      }
  }
  </code></pre>