Git revision for a specific line in file
Is there a way to get the commit hash for a specific line in a file? I'm able to get the revision for the whole file with this:
GitHistoryUtils.getLastRevision(currentProject, filePath);
Was hoping to get the actual revision for the line. Any thoughts?
请先登录再写评论。
This information is something that 'git blame' gives you, so you need to run the annotate operation inside IntelliJ IDEA. Use AnnotationProvider.annotate() and then FileAnnotation.getLineRevisionNumber(). Note that this does run 'git blame', so it's a fairly slow operation.