我想知道如何在提取請求後檢索已更改文件的列表。使用JGit獲取更改後的文件列表
我正在使用它來獲取所有合併的提交,但我想知道所有更改的文件。
Git git = new Git(localRepo);
PullCommand pullCmd = git.pull();
PullResult pullResult = pullCmd.call();
MergeResult mergeResult = pullResult.getMergeResult();
ObjectId[] mergedCommits = mergeResult.getMergedCommits();
for (ObjectId mergedCommit : mergedCommits) {
// And now?
}
我使用[jgit(http://www.eclipse.org/jgit/),而不是正常的git命令行工具。 – 2014-10-01 14:33:13
在這種情況下,看看是否有幫助:http://stackoverflow.com/questions/8520682/how-do-i-do-the-equivalent-of-git-diff-name-status-with-jgit 解決方案是使用diff-tree,如何在jgit中使用它在上面的鏈接中給出。 – 2014-10-01 14:41:14