I am trying to get the list of merged branch in my master branch by using git branch -a --merged master
in jenkins. When i try locally i get all the branch name after doing git pill/ git fetch --all
. the output shows locally:
git branch -a --merged master
* master
remotes/origin/master
remotes/origin/devBranch/1.0.0
remotes/origin/devBranch/1.1.0
remotes/origin/devBranch/1.2.0
same thing when i do in jenkinsfile. it only shows the master branch.
jenkinsfile:
steps{
withCredentials([usernamePassword(credentialsId: 'some_jenkins_cred_id', usernameVariable: 'GIT_USERNAME', passwordVariable: 'GIT_PASSWORD')]) {
sh("""
git config --global credential.username $GIT_USERNAME
git config --global credential.helper "!echo password=$GIT_PASSWORD; echo"
git fetch --all
git pull origin master
git branch -a --merged master
""")
}
}
i get output:
+ git fetch --all
Fetching origin
+ git pull origin master
From https://github.optum.com/paymentintegrity/orbit-spike-ness-logging
* branch master -> FETCH_HEAD
+ git branch -a --merged master
----> * master
remotes/origin/master
Any way to get the list of branch in jenkinsfile?
Thank you
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…