Skip to content

Instantly share code, notes, and snippets.

@wreulicke
Created November 24, 2017 08:10
Show Gist options
  • Save wreulicke/b3c0b00140e69246057eb447c68403e6 to your computer and use it in GitHub Desktop.
Save wreulicke/b3c0b00140e69246057eb447c68403e6 to your computer and use it in GitHub Desktop.
git-describe
@Grapes([
@Grab(group= 'org.eclipse.jgit', module= 'org.eclipse.jgit', version= '4.9.0.201710071750-r'),
//@Grab(group= 'org.eclipse.jgit', module= 'org.eclipse.jgit', version= '4.3.1.201605051710-r'),
])
import org.eclipse.jgit.api.Git
import org.eclipse.jgit.api.DescribeCommand
import org.eclipse.jgit.storage.file.FileRepositoryBuilder
def repo = FileRepositoryBuilder.create(new File(".", ".git"))
def git = new Git(repo)
println(git.describe().call())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment