Reputation: 535
I use this code from the JavaGit example:
File repositoryDirectory = new File("Library\\build\\jar\\");
DotGit dotGit = DotGit.getInstance(repositoryDirectory);
// Print commit messages of the current branch
for (Commit c : dotGit.getLog()) {
System.out.println(c.getMessage());
}
How could I get the id of commit this way? Or it might be more appropriate library to interact with git?
Upvotes: 0
Views: 118
Reputation: 8227
According to the documentation (I don't know very much this library), you should invoke the getCommitName()
method and use the returned Ref
object to get the information you want (I think the SHA1 hash or the tag).
Upvotes: 3