Git Tips Slides
PageUp x2: previous · PageDown x2: next · Home: index

History for selection

I do 95% of my git actions on the command-line. But "history for selection" is super cool. It is a feature of IntelliJ-based IDEs. You can select a region in the code and then you can have a look at the history of this region.

On the command line, the closest things I know are:

  • git blame -L 120,150 some-file: show who last changed lines 120 to 150
  • git log -L 120,150:some-file: show the history of that line range as patches
  • git log -L :my_function:some-file: show the history of one function

This is still not as convenient as the IntelliJ IDE solution, because on the command line you need line numbers or a function name first.

I switched to VS Code several years ago, but still miss this feature.

If you know how to get that in VS Code, please tell me.