IMLC.ME
Search…
en-US
git rev-parse HEAD alternative command in JGit
JGit does not provide extractly the same interface for what you run in comand line git rev-parse HEAD. Below snippets are what you need:
1
// git rev-parse HEAD
2
git.getRepository().exactRef("refs/heads/master").getObjectId().name()
3
4
// git rev-parse --short HEAD
5
git.getRepository().exactRef("refs/heads/master").getObjectId().abbreviate(7).name()
Copied!
Last modified 1yr ago
Copy link