小编Tha*_*n M的帖子

如何使用JGit获取提交的文件列表

我一直在研究基于Java的产品,Git功能将被集成到该产品中.使用Git功能之一,我已经通过staging将10多个文件添加到Git存储库中,然后在单个提交中提交它们.

上述过程的反向可能吗?即找到作为提交的一部分提交的文件列表.

我在git.log()命令的帮助下得到了提交,但我不知道如何获取提交的文件列表.

示例代码:

Git git = (...);
Iterable<RevCommit> logs = git.log().call();
for(RevCommit commit : logs) {
    String commitID = commit.getName();
    if(commitID != null && !commitID.isEmpty()) {
    TableItem item = new TableItem(table, SWT.None);
    item.setText(commitID);
    // Here I want to get the file list for the commit object
}
}
Run Code Online (Sandbox Code Playgroud)

java jgit

11
推荐指数
1
解决办法
5802
查看次数

标签 统计

java ×1

jgit ×1