5

How can I use the Jenkins Git plugin to check out a specific branch? I have installed Jenkins and I use the GIT plugin to clone a repository. Any help would be greatly appreciated.

James Umeris
  • 599
  • 2
  • 7
  • 15
  • Possible duplicate of [Checkout remote Git branch](http://stackoverflow.com/questions/1783405/checkout-remote-git-branch) – Don Scott Jan 09 '16 at 04:32
  • 1
    Not really duplicate. OP wants how to use Jenkins Git plugin. The linked question is specifically on git. – Jayan Jan 09 '16 at 11:32

3 Answers3

5

There is an option to pass branch name in Jenkins Git Plugin/ Git Parameter Plugin.

This accepts build parameters. So you could add parameter to the job, say with BRANCH_NAME and pass it to git plugin. Options are Just above the "Repository Browser" setting

click the image to see the full picture.

Here is with build parameter with parameter called BRANCH_NAME

Jayan
  • 18,003
  • 15
  • 89
  • 143
1

In "Branches to build" you have to:

  • put the branch name or */${GIT_BRANCH}

  • uncheck "Lightweight checkout" checkbox, which is below "Script Path"

blackgreen
  • 34,072
  • 23
  • 111
  • 129
0

Add the branch name in Branches to build bloc

enter image description here