Line history viewer - Git

Maybe annotations in IntelliJ IDEA is that you are looking for:

the left gutter with enabled annotations

Showing and hiding annotations

  1. Open the desired file in the editor.
  2. To show annotations, right-click the left gutter, and select Annotate:
    context menu
  3. To hide annotations, right-click the annotations gutter, and choose Close Annotations.

I know only the IntelliJ IDEA "Viewing Changes History for Selection" feature.

You could also try to use several git blame commands to iterate over history of a fragment.


git blame (docs)

git-blame shows what revision and author last modified each line of a file.

Usage examples

When you are interested in finding the origin for lines 40-50 for file foo, you can use the -L option like so (they mean the same thing — both ask for 11 lines starting at line 40):

git blame -L 40,50 foo.txt
git blame -L 40,+11 foo.txt

You can specify a revision for git blame to look back starting from (instead of the default of HEAD) if you want to find out who edited that lines before a specific commit (fe25b6d in this example; fe25b6d^ is the parent of fe25b6d):

git blame -L 40,+11 fe25b6d^ -- foo.txt