7

Jenkins v2.19

Git Plugin v2.5.3

Under Branches to Build I am specifying 2 branches:

*/develop

and

*/master

This results in a HEAD detached at {git commit hash}. I have different actions in my gradle build scripts that use the current git branch as a trigger to take different actions.

How can I make this checkout develop to develop and master to master rather than a detached HEAD?

Bill Mote
  • 12,644
  • 7
  • 58
  • 82
  • Possible duplicate of [Jenkins Git plugin detached HEAD](https://stackoverflow.com/questions/11511390/jenkins-git-plugin-detached-head) – Stephen Quan Jul 20 '17 at 06:11

1 Answers1

24

Set the following:

Additional Behaviours > Check out to specific local branch

Click on "?" to see details about this option.

  • 5
    This worked by leaving the `Check out to a specific local branch` field blank. Figured it out, but glad I get to give someone the checkmark. – Bill Mote Sep 02 '16 at 20:47