title: Jenkinsfile to checkout different repo and update a file
body: <p>I  have 2 repos A and B. At the end of build A, I want to update a properties file in repo B with the build number of A</p>
  <ol>
  <li>How can I checkout the <strong>master</strong> branch of <strong>repo B</strong> in repo A's Jenkinfile just for this stage(which is last) ?</li>
  <li>After checkout, can I follow the steps
  mentioned below to update the file or is there any better way to
  achieve it?</li>
  </ol>
  <p><strong>Jenkinsfile of repo A:</strong></p>
  <pre><code>        stage('Update properties file in repo B') {
              steps {
                  script {
                          // how do I checkout master branch ofrepo B here?
                          sh &quot;git config --global user.email jenkins@abc.com&quot;
                          sh &quot;git config --global user.name Jenkins&quot;
                          sh(script: 'echo &quot;repoA_VERSION=$BUILD_NUMBER&quot; &gt; version.properties', returnStdout: true).trim()
                          git add .
                          git commit -m &quot;Updated version.properties file with ${env.BUILD_NUMBER}&quot;
                  }
              }
          }
  </code></pre>