Last active
March 24, 2017 18:38
-
-
Save dkoudlo/551c15fb1be689231bb2eb7ed2d55324 to your computer and use it in GitHub Desktop.
Get Git Branches Names - Usefull to run on jenkins
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def defaultBranch = 'master' | |
def sshLinkToRepo = 'ssh://[email protected]/dkoudlo/py-manage-server.git' | |
def gettags = ("git ls-remote -t -h " + sshLinkToRepo + " refs/heads/*").execute() | |
def branchNames = [defaultBranch] + gettags.text.readLines().collect { it.split()[1].replaceAll('refs/heads/', '') } | |
return branchNames.unique() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment