RevCommit
有一个 getCommitTime()
方法,但它返回一个 int
并且没有作者时间。如何从 RevCommit
中获取作者和提交日期?
最佳答案
像这样:
RevCommit commit = ...;
PersonIdent authorIdent = commit.getAuthorIdent();
Date authorDate = authorIdent.getWhen();
TimeZone authorTimeZone = authorIdent.getTimeZone();
PersonIdent committerIdent = commit.getCommitterIdent();
...
另见 API documentation .
关于git - 您如何从 JGit RevCommit 中获取作者日期和提交日期?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12608610/