1 comment

Got my answer, will publish for visibility and help other people that may have the same questions.

 

Add dependency in build.gradle:

intellij {
...
plugins 'git4idea'
}

 

To do this in the code

GitRepositoryManager repositoryManager = GitUtil.getRepositoryManager(file.getProject());
java.util.List<GitRepository> repositories = repositoryManager.getRepositories();
for(GitRepository gitRepository: repositories){
String revision = gitRepository.getCurrentRevision();
}
2

Please sign in to leave a comment.