Get CommitMessage by commitID


I'm developing a IDEA plugin with idea4git and I need to get commit message by commit id which is get from VcsFullCommitDetails.getId.asString

I think I can get it by GitHistoryUtils.collectCommitsMetadata but I have no idea have to use it.Can anyone give me some suggestion?what's more, If I want to get changeList of the commit,which method should I use?

1 comment

I found the solution. By using GitHistoryUtils.loadDetails can get commit detail. Here is the code below:

List<String>commitIdList;   //suppose we have commit Id list here

var gitRespositoryManager = GitRespositoryManager.getInstance(project);
var gitRepository = gitRespositoryManager.getRepositoryForFile(LocalFileSystem.getInstance().findFileByPath(project.getBasePath()));
    gitCommit.getId();// Here is the commitId
    gitCommit.getFullMessage();// Here is the commit message
    gitCommit.getChanges();  //Here is the commit change list

Please sign in to leave a comment.