git - 您如何从 JGit RevCommit 中获取作者日期和提交日期?

标签 git jgit

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/

相关文章:

python - 使用 GitPython checkout 新分支并推送到远程

bitbucket - 克隆到基本目录 git@bitbucket.org :myapp/configurations. git 发送 channel 请求失败

git - 如何打印所有的 git commit 消息?

git - 无法通过 Git 在 azure 上部署静态网站

Git:压缩不是最近提交的连续提交,并且不从根开始

amazon-s3 - 用于访问 S3 上的 jgit 的 IAM 配置

java - 使用 JGit 从 Git 检索提交消息日志

git - 防止 git 写入空的 merge 提交

windows - Windows 上 Git 的无效文件描述符问题

bash - 如何列出在 Git 中更改了文件的所有文件夹名称?