What is the JGit equivalent API for the following command
git log --pretty=format:"%h - %an, %ar : %s"
I want to get the short form of SHA-1 commit id and the status of the file for that particular commit.
What is the JGit equivalent API for the following command
git log --pretty=format:"%h - %an, %ar : %s"
I want to get the short form of SHA-1 commit id and the status of the file for that particular commit.
JGit's LogCommand returns a list of RevCommits from which the information can be obtained.
commit.getId()To shorten a Git object id in JGit, you can use the abbreviate() method.
For example:
RevCommit commit = ...
ObjectId commitId = commit.getId();
String shortId = commitId.abbreviate( 7 ).name();
will shorten the given objectId to 7 characters.