Benjamin Barrois
Benjamin Barrois

Reputation: 2686

Check git history for a range of lines in VSCode

Is it possible in VSCode to show git history for a range of line ?

Let's say I have 1000 commits concerning this file, and a range of line in this file had its last change on commit 24, I have to check 976 commits in the editor.

I saw something related here, but is it possible directly in the IDE?

Upvotes: 20

Views: 13529

Answers (2)

mattiatantardini
mattiatantardini

Reputation: 793

You can see the commits related to only a set of lines by using the Gitlens extension.

That provides two functionalities, "File history" and "Line history", that are accessible from the VCS menu once Gitlens is installed.

In the "File history" tab you can see all the commits related to the currently viewed file, whereas in the "Line history" tab you only see the commits related to the currently selected lines.

Example below:

enter image description here

This is the gitlens documentation reference.

Upvotes: 11

myke
myke

Reputation: 541

I'm not aware of a way to do exactly what you ask for; and I'm not sure if it's at all possible (or what the exact semantics of it would be).

The closest workaround for me is to use the GitLens VSCode extension and specifically its Blame functionality.

Upvotes: 0

Related Questions