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?

1 comment

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.

0

Please sign in to leave a comment.