title: Jenkins Pipeline: How do I fetch (not pull) a different branch?
body: <p>I'm trying to use Jenkins Pipelines and I would like to diff the current branch of the job to <code>master</code>. For that I need to have <code>master</code> checked out. Jenkins only checks out the branch I'm building.</p>
  
  <p>I tried:
  <code>
  withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'GITHUB', usernameVariable:  'GIT_USERNAME', passwordVariable: 'GIT_PASSWORD']]) {
     sh 'git fetch origin master:master'
  }
  </code></p>
  
  <p>but that only binds the credentials to the ENV variables and git doesn't pick that up.</p>
  
  <p>All the other approaches I've seen use checkout, but that would change my current branch. I only want to fetch the master so I can do a <code>git diff</code> later</p>