GitLens, a VScode extension that probably resolves conflicts among developers.

So, what is Git Lens?

Git lens is a VScode extension created by Eric Amodio. It helps you to visualize code authorship at a glance via Git blame annotations and code lens.

What the blockquote above simply means, is, with GitLens you (as a developer, product manager, code reviewer. etc.) gets to know who made, maybe a single change on a particular line of code, why they made the change, the previous state of that line of code. etc.

Simply put, with GitLens' rich features you get to see how a codebase evolves over time as the developers make changes to it.

In this article, we're going to take a look at some of the features of GitLens and how you can install the extension in your code editor (VScode).

Installing the extension

Simply go to the left corner of your screen, in the VScode environment and click on the "extensions" icon and type "git lens" into the search box that pops up. You'd get something similar to the image below, then click on "install".

Screenshot from 2020-09-04 23-38-53.png

Below are some of the features that I'd be discussing.

current line blame

The "current line blame" feature shows the name/GitHub username of the person that made changes to that line.

This feature can be triggered by hovering on the name of the person. See the illustration below.

current-line.gif

Authorship-lens

The "Authorship lens" shows the number of people that contributed to a particular file at the top of the file and their recent commit messages. It also shows the author(s) of specific code blocks.

When you click on a particular author, their commit messages come up beside your current file.

authorship.gif

Status bar blame

The status bar blame shows the name of the author that made the commit(s) as you click on each line of code and the timestamp.

Note how the timestamp on the status blame changes, as I click on different lines.

You can also click on the status blame feature, which simply shows a commit details menu, where you can get some basic commands needed in exploring previous commit messages.

status-blame.gif

Previous file changes from line hover feature

Remember how we saw the "current line blame" feature in action? All we needed to do was just to click on a particular line of code and hover on the annotation.

For you to see the previous file change, all you need to do is click the "changes" keyword on the GitLens popup box, and voila!

previous-change.gif

Conclusion

The features discussed above are not the only features of GitLens, there are tons of them available, but these ones that you have seen are enough to get you up and running.

But if you want to get more configurations for GitLens in your environment, you can head on to their website and get familiar with their documentation.

Thank you for reading this article :), kindly share it with your network, and don't forget to give a "thumbs up" if it has helped you.

Comments (2)

Theophilus Ige's photo

Great one bro

Caleb Olojo's photo

Thank you! 😊