title: Can Jenkins Pipeline checkout a commit that has not been merged?
body: <p>I am attempting to test a Jenkinsfile, with docker images, and various tests using a Jenkins Pipeline. I am able to checkout the latest code from Gerrit using a branch name or a merged commit hash. But, want to know if it is possible to test using an un-merged commit hash. I am trying to test this using a commit before it is merged for the following reasons:</p>
  
  <ol>
  <li>In case the commit breaks existing code.</li>
  <li>In case my docker images and other files are not actually set up properly. If I were to find an error in the Jenkinsfile or other configuration files, I would have to keep pushing code until I get it right. </li>
  </ol>
  
  <p>Is this possible? How do you all test your files and pipeline before merging?</p>
  
  <p>The following is my Jenkinsfile syntax:</p>
  
  <pre><code>pipeline {
     agent any
  
      stages {
          stage('Checkout git repository') {
              agent any
              steps {
                  checkout([
                      $class: 'GitSCM',
                      branches: [[name: '&lt;un-merged commit hash&gt;']],
                      extensions: [[$class: 'WipeWorkspace']],
                      userRemoteConfigs: [[
                          credentialsId: '&lt;credentials hash&gt;',
                          url: '&lt;git repository url&gt;'
                      ]]
                  ])
              }
          }
      }
  }
  </code></pre>