I\'m trying to get the name of my branch for a jenkins groovy script. I cannot get the current branch name. I try the following:
stage(\'Check out code\') ch
My workaround, Don't know if work for someone else..
def branchName = getCurrentBranch() echo 'My branch is' + branchName def getCurrentBranch () { return sh ( script: 'git rev-parse --abbrev-ref HEAD', returnStdout: true ).trim() }